Xero Accounting API

Accounting

createAccount

Creates a new chart of accounts


/Accounts

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Accounts"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        
        Account account = new Account();
        account.setCode("123456");
        account.setName("FooBar");
        account.setType(com.xero.models.accounting.AccountType.EXPENSE);
        account.setDescription("Hello World");

        try {
            Accounts result = apiInstance.createAccount(accessToken, xeroTenantId, account);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createAccount");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Account account = { "Code":"123456", "Name":"Foobar", "Type":"EXPENSE", "Description":"Hello World" }; // Account | 
        try {
            Accounts result = apiInstance.createAccount(xeroTenantId, account);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createAccount");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Account *account = { "Code":"123456", "Name":"Foobar", "Type":"EXPENSE", "Description":"Hello World" }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a new chart of accounts
[apiInstance createAccountWith:xeroTenantId
    account:account
              completionHandler: ^(Accounts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';

const account: Account = { 
    code: "123456",
    name: "FooBar",
    type: AccountType.EXPENSE,
    description: "Hello World" }; 

try {
  const response = await xero.accountingApi.createAccount(xeroTenantId, account);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateAccountExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";

            var account = new Account();
            account.Code = "123456";
            account.Name = "FooBar";
            account.Type = AccountType.EXPENSE;
            account.Description = "Hello World";
            
            try {
                var result = await apiInstance.CreateAccountAsync(accessToken, xeroTenantId, account);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateAccount: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

$account = new XeroAPI\XeroPHP\Models\Accounting\Account;
$account->setCode('123456');
$account->setName('FooBar');
$account->setType(XeroAPI\XeroPHP\Models\Accounting\AccountType::EXPENSE);
$account->setDescription('Hello World');

try {
  $result = $apiInstance->createAccount($xeroTenantId, $account);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createAccount: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $account = ::Object::Account->new(); # Account | 

eval { 
    my $result = $api_instance->createAccount(xeroTenantId => $xeroTenantId, account => $account);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createAccount: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_account():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'

    account = Account(
        code = "123456",
        name = "FooBar",
        type = AccountType.EXPENSE,
        description = "Hello World")
    
    try:
        api_response = api_instance.create_account(xero_tenant_id, account)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createAccount: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let account = { "Code":"123456", "Name":"Foobar", "Type":"EXPENSE", "Description":"Hello World" }; // Account

    let mut context = AccountingApi::Context::default();
    let result = client.createAccount(xeroTenantId, account, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
account *
Account
Account object in body of request
Required

createAccountAttachmentByFileName

Creates an attachment on a specific account


/Accounts/{AccountID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Accounts/{AccountID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID accountID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.createAccountAttachmentByFileName(accessToken, xeroTenantId, accountID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createAccountAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID accountID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Account object
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.createAccountAttachmentByFileName(xeroTenantId, accountID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createAccountAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *accountID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Account object (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates an attachment on a specific account
[apiInstance createAccountAttachmentByFileNameWith:xeroTenantId
    accountID:accountID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const accountID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createAccountAttachmentByFileName(xeroTenantId, accountID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateAccountAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var accountID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.CreateAccountAttachmentByFileNameAsync(accessToken, xeroTenantId, accountID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateAccountAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$accountID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->createAccountAttachmentByFileName($xeroTenantId, $accountID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createAccountAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $accountID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Account object
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->createAccountAttachmentByFileName(xeroTenantId => $xeroTenantId, accountID => $accountID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createAccountAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_account_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    account_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.create_account_attachment_by_file_name(xero_tenant_id, account_id, file_name, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createAccountAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let accountID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.createAccountAttachmentByFileName(xeroTenantId, accountID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
AccountID*
UUID (uuid)
Unique identifier for Account object
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

createBankTransactionAttachmentByFileName

Creates an attachment for a specific bank transaction by filename


/BankTransactions/{BankTransactionID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransactions/{BankTransactionID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID bankTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.createBankTransactionAttachmentByFileName(accessToken, xeroTenantId, bankTransactionID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createBankTransactionAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transaction
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.createBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createBankTransactionAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransactionID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transaction (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates an attachment for a specific bank transaction by filename
[apiInstance createBankTransactionAttachmentByFileNameWith:xeroTenantId
    bankTransactionID:bankTransactionID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransactionID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateBankTransactionAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransactionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.CreateBankTransactionAttachmentByFileNameAsync(accessToken, xeroTenantId, bankTransactionID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateBankTransactionAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransactionID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->createBankTransactionAttachmentByFileName($xeroTenantId, $bankTransactionID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createBankTransactionAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transaction
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->createBankTransactionAttachmentByFileName(xeroTenantId => $xeroTenantId, bankTransactionID => $bankTransactionID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createBankTransactionAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_bank_transaction_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transaction_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.create_bank_transaction_attachment_by_file_name(xero_tenant_id, bank_transaction_id, file_name, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createBankTransactionAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.createBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
BankTransactionID*
UUID (uuid)
Xero generated unique identifier for a bank transaction
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

createBankTransactionHistoryRecord

Creates a history record for a specific bank transactions


/BankTransactions/{BankTransactionID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransactions/{BankTransactionID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID bankTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createBankTransactionHistoryRecord(accessToken, xeroTenantId, bankTransactionID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createBankTransactionHistoryRecord");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transaction
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createBankTransactionHistoryRecord(xeroTenantId, bankTransactionID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createBankTransactionHistoryRecord");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransactionID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transaction (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific bank transactions
[apiInstance createBankTransactionHistoryRecordWith:xeroTenantId
    bankTransactionID:bankTransactionID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransactionID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
    details: "Hello World" }; 

const historyRecords: HistoryRecords = {  
    historyRecords: [historyRecord] }; 

try {
  const response = await xero.accountingApi.createBankTransactionHistoryRecord(xeroTenantId, bankTransactionID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateBankTransactionHistoryRecordExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransactionID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateBankTransactionHistoryRecordAsync(accessToken, xeroTenantId, bankTransactionID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateBankTransactionHistoryRecord: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransactionID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createBankTransactionHistoryRecord($xeroTenantId, $bankTransactionID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createBankTransactionHistoryRecord: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transaction
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createBankTransactionHistoryRecord(xeroTenantId => $xeroTenantId, bankTransactionID => $bankTransactionID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createBankTransactionHistoryRecord: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_bank_transaction_history_record():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transaction_id = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    historyRecords = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_bank_transaction_history_record(xero_tenant_id, bank_transaction_id, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createBankTransactionHistoryRecord: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createBankTransactionHistoryRecord(xeroTenantId, bankTransactionID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
BankTransactionID*
UUID (uuid)
Xero generated unique identifier for a bank transaction
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createBankTransactions

Creates one or more spent or received money transaction


/BankTransactions

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransactions?summarizeErrors=true&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        Boolean summarizeErrors = true;
        Integer unitdp = 4;
        
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");

        List<LineItem> lineItems = new ArrayList<LineItem>();
        lineItems.add(lineItem);
        
        Account bankAccount = new Account();
        bankAccount.setAccountID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        BankTransaction bankTransaction = new BankTransaction();
        bankTransaction.setType(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE);
        bankTransaction.setContact(contact);
        bankTransaction.setLineItems(lineItems);
        bankTransaction.setBankAccount(bankAccount);
        
        BankTransactions bankTransactions = new BankTransactions();
        bankTransactions.addBankTransactionsItem(bankTransaction);

        try {
            BankTransactions result = apiInstance.createBankTransactions(accessToken, xeroTenantId, bankTransactions, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createBankTransactions");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        BankTransactions bankTransactions = { bankTransactions: [{ type: BankTransaction.TypeEnum.SPEND, contact: { contactID: "00000000-0000-0000-0000-000000000000" }, lineItems: [{ description: "Foobar", quantity: 1.0, unitAmount: 20.0, accountCode: "000" } ], bankAccount: { code: "000" }}]}; // BankTransactions | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            BankTransactions result = apiInstance.createBankTransactions(xeroTenantId, bankTransactions, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createBankTransactions");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
BankTransactions *bankTransactions = { bankTransactions: [{ type: BankTransaction.TypeEnum.SPEND, contact: { contactID: "00000000-0000-0000-0000-000000000000" }, lineItems: [{ description: "Foobar", quantity: 1.0, unitAmount: 20.0, accountCode: "000" } ], bankAccount: { code: "000" }}]}; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates one or more spent or received money transaction
[apiInstance createBankTransactionsWith:xeroTenantId
    bankTransactions:bankTransactions
    summarizeErrors:summarizeErrors
    unitdp:unitdp
              completionHandler: ^(BankTransactions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;
const unitdp = 4;

const contact: Contact = { 
    contactID: "00000000-0000-0000-0000-000000000000" }; 

const lineItem: LineItem = { 
    description: "Foobar",
    quantity: 1.0,
    unitAmount: 20.0,
    accountCode: "000" };   
const lineItems = [];    
lineItems.push(lineItem)

const bankAccount: Account = { 
    accountID: "00000000-0000-0000-0000-000000000000" }; 

const bankTransaction: BankTransaction = { 
    type: BankTransaction.TypeEnum.RECEIVE,
    contact: contact,
    lineItems: lineItems,
    bankAccount: bankAccount }; 

const bankTransactions: BankTransactions = {  
    bankTransactions: [bankTransaction] }; 

try {
  const response = await xero.accountingApi.createBankTransactions(xeroTenantId, bankTransactions,  summarizeErrors, unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateBankTransactionsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;
            var unitdp = 4;

            var contact = new Contact();
            contact.ContactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var lineItem = new LineItem();
            lineItem.Description = "Foobar";
            lineItem.Quantity = new decimal(1.0);
            lineItem.UnitAmount = new decimal(20.0);
            lineItem.AccountCode = "000";
            var lineItems = new List<LineItem>();
            lineItems.Add(lineItem);

            var bankAccount = new Account();
            bankAccount.AccountID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var bankTransaction = new BankTransaction();
            bankTransaction.Type = BankTransaction.TypeEnum.RECEIVE;
            bankTransaction.Contact = contact;
            bankTransaction.LineItems = lineItems;
            bankTransaction.BankAccount = bankAccount;

            var bankTransactions = new BankTransactions();
            var bankTransactionsList = new List<BankTransaction>();
            bankTransactionsList.Add(bankTransaction); 
            bankTransactions._BankTransactions = bankTransactionsList;
            
            try {
                var result = await apiInstance.CreateBankTransactionsAsync(accessToken, xeroTenantId, bankTransactions, summarizeErrors, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateBankTransactions: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$unitdp = 4;

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItems = [];
array_push($lineItems, $lineItem);

$bankAccount = new XeroAPI\XeroPHP\Models\Accounting\Account;
$bankAccount->setAccountID('00000000-0000-0000-0000-000000000000');

$bankTransaction = new XeroAPI\XeroPHP\Models\Accounting\BankTransaction;
$bankTransaction->setType(XeroAPI\XeroPHP\Models\Accounting\BankTransaction::TYPE_RECEIVE);
$bankTransaction->setContact($contact);
$bankTransaction->setLineItems($lineItems);
$bankTransaction->setBankAccount($bankAccount);

$bankTransactions = new XeroAPI\XeroPHP\Models\Accounting\BankTransactions;
$arr_bank_transactions = [];
array_push($arr_bank_transactions, $bankTransaction);
$bankTransactions->setBankTransactions($arr_bank_transactions);

try {
  $result = $apiInstance->createBankTransactions($xeroTenantId, $bankTransactions, $summarizeErrors, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createBankTransactions: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransactions = ::Object::BankTransactions->new(); # BankTransactions | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->createBankTransactions(xeroTenantId => $xeroTenantId, bankTransactions => $bankTransactions, summarizeErrors => $summarizeErrors, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createBankTransactions: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_bank_transactions():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000")
    
    line_items = []    
    line_items.append(line_item)

    bank_account = Account(
        account_id = "00000000-0000-0000-0000-000000000000")

    bank_transaction = BankTransaction(
        type = "RECEIVE",
        contact = contact,
        lineItems = lineItems,
        bank_account = bank_account)

    bankTransactions = BankTransactions( 
        bank_transactions = [bank_transaction])
    
    try:
        api_response = api_instance.create_bank_transactions(xero_tenant_id, bankTransactions, summarize_errors, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createBankTransactions: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransactions = { bankTransactions: [{ type: BankTransaction.TypeEnum.SPEND, contact: { contactID: "00000000-0000-0000-0000-000000000000" }, lineItems: [{ description: "Foobar", quantity: 1.0, unitAmount: 20.0, accountCode: "000" } ], bankAccount: { code: "000" }}]}; // BankTransactions
    let summarizeErrors = true; // Boolean
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.createBankTransactions(xeroTenantId, bankTransactions, summarizeErrors, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
bankTransactions *
BankTransactions
BankTransactions with an array of BankTransaction objects in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

createBankTransfer

Creates a bank transfer


/BankTransfers

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransfers"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        
        Account fromBankAccount = new Account();
        fromBankAccount.setAccountID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        Account toBankAccount = new Account();
        toBankAccount.setAccountID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        BankTransfer bankTransfer = new BankTransfer();
        bankTransfer.setFromBankAccount(fromBankAccount);
        bankTransfer.setToBankAccount(toBankAccount);
        bankTransfer.setAmount(1.0);
        
        BankTransfers bankTransfers = new BankTransfers();
        bankTransfers.addBankTransfersItem(bankTransfer);

        try {
            BankTransfers result = apiInstance.createBankTransfer(accessToken, xeroTenantId, bankTransfers);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createBankTransfer");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        BankTransfers bankTransfers = { "BankTransfers": [ { "FromBankAccount": { "Code": "090", "Name": "My Savings", "AccountID": "00000000-0000-0000-0000-000000000000", "Type": "BANK", "BankAccountNumber": "123455", "Status": "ACTIVE", "BankAccountType": "BANK", "CurrencyCode": "USD", "TaxType": "NONE", "EnablePaymentsToAccount": false, "ShowInExpenseClaims": false, "Class": "ASSET", "ReportingCode": "ASS", "ReportingCodeName": "Assets", "HasAttachments": false, "UpdatedDateUTC": "2016-10-17T13:45:33.993-07:00" }, "ToBankAccount": { "Code": "088", "Name": "Business Wells Fargo", "AccountID": "00000000-0000-0000-0000-000000000000", "Type": "BANK", "BankAccountNumber": "123455", "Status": "ACTIVE", "BankAccountType": "BANK", "CurrencyCode": "USD", "TaxType": "NONE", "EnablePaymentsToAccount": false, "ShowInExpenseClaims": false, "Class": "ASSET", "ReportingCode": "ASS", "ReportingCodeName": "Assets", "HasAttachments": false, "UpdatedDateUTC": "2016-06-03T08:31:14.517-07:00" }, "Amount": "50.00" } ] }; // BankTransfers | 
        try {
            BankTransfers result = apiInstance.createBankTransfer(xeroTenantId, bankTransfers);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createBankTransfer");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
BankTransfers *bankTransfers = { "BankTransfers": [ { "FromBankAccount": { "Code": "090", "Name": "My Savings", "AccountID": "00000000-0000-0000-0000-000000000000", "Type": "BANK", "BankAccountNumber": "123455", "Status": "ACTIVE", "BankAccountType": "BANK", "CurrencyCode": "USD", "TaxType": "NONE", "EnablePaymentsToAccount": false, "ShowInExpenseClaims": false, "Class": "ASSET", "ReportingCode": "ASS", "ReportingCodeName": "Assets", "HasAttachments": false, "UpdatedDateUTC": "2016-10-17T13:45:33.993-07:00" }, "ToBankAccount": { "Code": "088", "Name": "Business Wells Fargo", "AccountID": "00000000-0000-0000-0000-000000000000", "Type": "BANK", "BankAccountNumber": "123455", "Status": "ACTIVE", "BankAccountType": "BANK", "CurrencyCode": "USD", "TaxType": "NONE", "EnablePaymentsToAccount": false, "ShowInExpenseClaims": false, "Class": "ASSET", "ReportingCode": "ASS", "ReportingCodeName": "Assets", "HasAttachments": false, "UpdatedDateUTC": "2016-06-03T08:31:14.517-07:00" }, "Amount": "50.00" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a bank transfer
[apiInstance createBankTransferWith:xeroTenantId
    bankTransfers:bankTransfers
              completionHandler: ^(BankTransfers output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';

const fromBankAccount: Account = { 
    accountID: "00000000-0000-0000-0000-000000000000" }; 

const toBankAccount: Account = { 
    accountID: "00000000-0000-0000-0000-000000000000" }; 

const bankTransfer: BankTransfer = { 
    fromBankAccount: fromBankAccount,
    toBankAccount: toBankAccount,
    amount: 1.0 }; 

const bankTransfers: BankTransfers = {  
    bankTransfers: [bankTransfer] }; 

try {
  const response = await xero.accountingApi.createBankTransfer(xeroTenantId, bankTransfers);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateBankTransferExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";

            var fromBankAccount = new Account();
            fromBankAccount.AccountID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var toBankAccount = new Account();
            toBankAccount.AccountID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var bankTransfer = new BankTransfer();
            bankTransfer.FromBankAccount = fromBankAccount;
            bankTransfer.ToBankAccount = toBankAccount;
            bankTransfer.Amount = new decimal(1.0);

            var bankTransfers = new BankTransfers();
            var bankTransfersList = new List<BankTransfer>();
            bankTransfersList.Add(bankTransfer); 
            bankTransfers._BankTransfers = bankTransfersList;
            
            try {
                var result = await apiInstance.CreateBankTransferAsync(accessToken, xeroTenantId, bankTransfers);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateBankTransfer: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

$fromBankAccount = new XeroAPI\XeroPHP\Models\Accounting\Account;
$fromBankAccount->setAccountID('00000000-0000-0000-0000-000000000000');

$toBankAccount = new XeroAPI\XeroPHP\Models\Accounting\Account;
$toBankAccount->setAccountID('00000000-0000-0000-0000-000000000000');

$bankTransfer = new XeroAPI\XeroPHP\Models\Accounting\BankTransfer;
$bankTransfer->setFromBankAccount($fromBankAccount);
$bankTransfer->setToBankAccount($toBankAccount);
$bankTransfer->setAmount(1.0);

$bankTransfers = new XeroAPI\XeroPHP\Models\Accounting\BankTransfers;
$arr_bank_transfers = [];
array_push($arr_bank_transfers, $bankTransfer);
$bankTransfers->setBankTransfers($arr_bank_transfers);

try {
  $result = $apiInstance->createBankTransfer($xeroTenantId, $bankTransfers);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createBankTransfer: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransfers = ::Object::BankTransfers->new(); # BankTransfers | 

eval { 
    my $result = $api_instance->createBankTransfer(xeroTenantId => $xeroTenantId, bankTransfers => $bankTransfers);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createBankTransfer: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_bank_transfer():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'

    fromBankAccount = Account(
        account_id = "00000000-0000-0000-0000-000000000000")

    toBankAccount = Account(
        account_id = "00000000-0000-0000-0000-000000000000")

    bank_transfer = BankTransfer(
        from_bank_account = fromBankAccount,
        to_bank_account = toBankAccount,
        amount = 1.0)

    bankTransfers = BankTransfers( 
        bank_transfers = [bank_transfer])
    
    try:
        api_response = api_instance.create_bank_transfer(xero_tenant_id, bankTransfers)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createBankTransfer: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransfers = { "BankTransfers": [ { "FromBankAccount": { "Code": "090", "Name": "My Savings", "AccountID": "00000000-0000-0000-0000-000000000000", "Type": "BANK", "BankAccountNumber": "123455", "Status": "ACTIVE", "BankAccountType": "BANK", "CurrencyCode": "USD", "TaxType": "NONE", "EnablePaymentsToAccount": false, "ShowInExpenseClaims": false, "Class": "ASSET", "ReportingCode": "ASS", "ReportingCodeName": "Assets", "HasAttachments": false, "UpdatedDateUTC": "2016-10-17T13:45:33.993-07:00" }, "ToBankAccount": { "Code": "088", "Name": "Business Wells Fargo", "AccountID": "00000000-0000-0000-0000-000000000000", "Type": "BANK", "BankAccountNumber": "123455", "Status": "ACTIVE", "BankAccountType": "BANK", "CurrencyCode": "USD", "TaxType": "NONE", "EnablePaymentsToAccount": false, "ShowInExpenseClaims": false, "Class": "ASSET", "ReportingCode": "ASS", "ReportingCodeName": "Assets", "HasAttachments": false, "UpdatedDateUTC": "2016-06-03T08:31:14.517-07:00" }, "Amount": "50.00" } ] }; // BankTransfers

    let mut context = AccountingApi::Context::default();
    let result = client.createBankTransfer(xeroTenantId, bankTransfers, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
bankTransfers *
BankTransfers
BankTransfers with array of BankTransfer objects in request body
Required

createBankTransferAttachmentByFileName


/BankTransfers/{BankTransferID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransfers/{BankTransferID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID bankTransferID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.createBankTransferAttachmentByFileName(accessToken, xeroTenantId, bankTransferID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createBankTransferAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transfer
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.createBankTransferAttachmentByFileName(xeroTenantId, bankTransferID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createBankTransferAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransferID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transfer (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// 
[apiInstance createBankTransferAttachmentByFileNameWith:xeroTenantId
    bankTransferID:bankTransferID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransferID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createBankTransferAttachmentByFileName(xeroTenantId, bankTransferID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateBankTransferAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransferID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.CreateBankTransferAttachmentByFileNameAsync(accessToken, xeroTenantId, bankTransferID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateBankTransferAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransferID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->createBankTransferAttachmentByFileName($xeroTenantId, $bankTransferID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createBankTransferAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransferID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transfer
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->createBankTransferAttachmentByFileName(xeroTenantId => $xeroTenantId, bankTransferID => $bankTransferID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createBankTransferAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_bank_transfer_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transfer_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.create_bank_transfer_attachment_by_file_name(xero_tenant_id, bank_transfer_id, file_name, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createBankTransferAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.createBankTransferAttachmentByFileName(xeroTenantId, bankTransferID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
BankTransferID*
UUID (uuid)
Xero generated unique identifier for a bank transfer
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

createBankTransferHistoryRecord

Creates a history record for a specific bank transfer


/BankTransfers/{BankTransferID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransfers/{BankTransferID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID bankTransferID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createBankTransferHistoryRecord(accessToken, xeroTenantId, bankTransferID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createBankTransferHistoryRecord");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transfer
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createBankTransferHistoryRecord(xeroTenantId, bankTransferID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createBankTransferHistoryRecord");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransferID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transfer (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific bank transfer
[apiInstance createBankTransferHistoryRecordWith:xeroTenantId
    bankTransferID:bankTransferID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransferID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
    details: "Hello World" }; 

const historyRecords: HistoryRecords = {  
    historyRecords: [historyRecord] }; 

try {
  const response = await xero.accountingApi.createBankTransferHistoryRecord(xeroTenantId, bankTransferID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateBankTransferHistoryRecordExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransferID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateBankTransferHistoryRecordAsync(accessToken, xeroTenantId, bankTransferID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateBankTransferHistoryRecord: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransferID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createBankTransferHistoryRecord($xeroTenantId, $bankTransferID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createBankTransferHistoryRecord: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransferID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transfer
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createBankTransferHistoryRecord(xeroTenantId => $xeroTenantId, bankTransferID => $bankTransferID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createBankTransferHistoryRecord: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_bank_transfer_history_record():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transfer_id = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    historyRecords = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_bank_transfer_history_record(xero_tenant_id, bank_transfer_id, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createBankTransferHistoryRecord: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createBankTransferHistoryRecord(xeroTenantId, bankTransferID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
BankTransferID*
UUID (uuid)
Xero generated unique identifier for a bank transfer
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createBatchPayment

Creates one or many batch payments for invoices


/BatchPayments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BatchPayments?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        Boolean summarizeErrors = true;
        LocalDate currDate = LocalDate.now();
        
        Account paymentAccount = new Account();
        paymentAccount.setAccountID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        Account bankAccount = new Account();
        bankAccount.setAccountID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        Invoice invoice = new Invoice();
        invoice.setInvoiceID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        Payment payment = new Payment();
        payment.setAccount(bankAccount);
        payment.setDate(currDate);
        payment.setAmount(1.0);
        payment.setInvoice(invoice);

        List<Payment> payments = new ArrayList<Payment>();
        payments.add(payment);
        
        BatchPayment batchPayment = new BatchPayment();
        batchPayment.setAccount(paymentAccount);
        batchPayment.setReference("hello foobar");
        batchPayment.setDate(currDate);
        batchPayment.setPayments(payments);
        
        BatchPayments batchPayments = new BatchPayments();
        batchPayments.addBatchPaymentsItem(batchPayment);

        try {
            BatchPayments result = apiInstance.createBatchPayment(accessToken, xeroTenantId, batchPayments, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createBatchPayment");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        BatchPayments batchPayments = { "BatchPayments": [ { "Account": { "AccountID": "00000000-0000-0000-0000-000000000000" }, "Reference": "ref", "Date": "2018-08-01", "Payments": [ { "Account": { "Code": "001" }, "Date": "2019-12-31", "Amount": 500, "Invoice": { "InvoiceID": "00000000-0000-0000-0000-000000000000", "LineItems": [], "Contact": {}, "Type": "ACCPAY" } } ] } ] }; // BatchPayments | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            BatchPayments result = apiInstance.createBatchPayment(xeroTenantId, batchPayments, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createBatchPayment");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
BatchPayments *batchPayments = { "BatchPayments": [ { "Account": { "AccountID": "00000000-0000-0000-0000-000000000000" }, "Reference": "ref", "Date": "2018-08-01", "Payments": [ { "Account": { "Code": "001" }, "Date": "2019-12-31", "Amount": 500, "Invoice": { "InvoiceID": "00000000-0000-0000-0000-000000000000", "LineItems": [], "Contact": {}, "Type": "ACCPAY" } } ] } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates one or many batch payments for invoices
[apiInstance createBatchPaymentWith:xeroTenantId
    batchPayments:batchPayments
    summarizeErrors:summarizeErrors
              completionHandler: ^(BatchPayments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;
const currDate = '2020-12-10'

const paymentAccount: Account = { 
    accountID: "00000000-0000-0000-0000-000000000000" }; 

const bankAccount: Account = { 
    accountID: "00000000-0000-0000-0000-000000000000" }; 

const invoice: Invoice = { 
    invoiceID: "00000000-0000-0000-0000-000000000000" }; 

const payment: Payment = { 
    account: bankAccount,
    date: currDate,
    amount: 1.0,
    invoice: invoice };   
const payments = [];    
payments.push(payment)

const batchPayment: BatchPayment = { 
    account: paymentAccount,
    reference: "hello foobar",
    date: currDate,
    payments: payments }; 

const batchPayments: BatchPayments = {  
    batchPayments: [batchPayment] }; 

try {
  const response = await xero.accountingApi.createBatchPayment(xeroTenantId, batchPayments,  summarizeErrors);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateBatchPaymentExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;
            var currDate = DateTime.Now;

            var paymentAccount = new Account();
            paymentAccount.AccountID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var bankAccount = new Account();
            bankAccount.AccountID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var invoice = new Invoice();
            invoice.InvoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var payment = new Payment();
            payment.Account = bankAccount;
            payment.Date = currDate;
            payment.Amount = new decimal(1.0);
            payment.Invoice = invoice;
            var payments = new List<Payment>();
            payments.Add(payment);

            var batchPayment = new BatchPayment();
            batchPayment.Account = paymentAccount;
            batchPayment.Reference = "hello foobar";
            batchPayment.Date = currDate;
            batchPayment.Payments = payments;

            var batchPayments = new BatchPayments();
            var batchPaymentsList = new List<BatchPayment>();
            batchPaymentsList.Add(batchPayment); 
            batchPayments._BatchPayments = batchPaymentsList;
            
            try {
                var result = await apiInstance.CreateBatchPaymentAsync(accessToken, xeroTenantId, batchPayments, summarizeErrors);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateBatchPayment: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$currDate = new DateTime('2020-12-10');

$paymentAccount = new XeroAPI\XeroPHP\Models\Accounting\Account;
$paymentAccount->setAccountID('00000000-0000-0000-0000-000000000000');

$bankAccount = new XeroAPI\XeroPHP\Models\Accounting\Account;
$bankAccount->setAccountID('00000000-0000-0000-0000-000000000000');

$invoice = new XeroAPI\XeroPHP\Models\Accounting\Invoice;
$invoice->setInvoiceID('00000000-0000-0000-0000-000000000000');

$payment = new XeroAPI\XeroPHP\Models\Accounting\Payment;
$payment->setAccount($bankAccount);
$payment->setDate($currDate);
$payment->setAmount(1.0);
$payment->setInvoice($invoice);
$payments = [];
array_push($payments, $payment);

$batchPayment = new XeroAPI\XeroPHP\Models\Accounting\BatchPayment;
$batchPayment->setAccount($paymentAccount);
$batchPayment->setReference('hello foobar');
$batchPayment->setDate($currDate);
$batchPayment->setPayments($payments);

$batchPayments = new XeroAPI\XeroPHP\Models\Accounting\BatchPayments;
$arr_batch_payments = [];
array_push($arr_batch_payments, $batchPayment);
$batchPayments->setBatchPayments($arr_batch_payments);

try {
  $result = $apiInstance->createBatchPayment($xeroTenantId, $batchPayments, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createBatchPayment: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $batchPayments = ::Object::BatchPayments->new(); # BatchPayments | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->createBatchPayment(xeroTenantId => $xeroTenantId, batchPayments => $batchPayments, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createBatchPayment: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_batch_payment():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'
    curr_date = dateutil.parser.parse('2020-12-03T00:00:00Z')

    payment_account = Account(
        account_id = "00000000-0000-0000-0000-000000000000")

    bank_account = Account(
        account_id = "00000000-0000-0000-0000-000000000000")

    invoice = Invoice(
        invoice_id = "00000000-0000-0000-0000-000000000000")

    payment = Payment(
        account = bank_account,
        date = curr_date,
        amount = 1.0,
        invoice = invoice)
    
    payments = []    
    payments.append(payment)

    batch_payment = BatchPayment(
        account = payment_account,
        reference = "hello foobar",
        date = curr_date,
        payments = payments)

    batchPayments = BatchPayments( 
        batch_payments = [batch_payment])
    
    try:
        api_response = api_instance.create_batch_payment(xero_tenant_id, batchPayments, summarize_errors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createBatchPayment: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let batchPayments = { "BatchPayments": [ { "Account": { "AccountID": "00000000-0000-0000-0000-000000000000" }, "Reference": "ref", "Date": "2018-08-01", "Payments": [ { "Account": { "Code": "001" }, "Date": "2019-12-31", "Amount": 500, "Invoice": { "InvoiceID": "00000000-0000-0000-0000-000000000000", "LineItems": [], "Contact": {}, "Type": "ACCPAY" } } ] } ] }; // BatchPayments
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.createBatchPayment(xeroTenantId, batchPayments, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
batchPayments *
BatchPayments
BatchPayments with an array of Payments in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

createBatchPaymentHistoryRecord

Creates a history record for a specific batch payment


/BatchPayments/{BatchPaymentID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BatchPayments/{BatchPaymentID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID batchPaymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createBatchPaymentHistoryRecord(accessToken, xeroTenantId, batchPaymentID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createBatchPaymentHistoryRecord");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID batchPaymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for BatchPayment
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createBatchPaymentHistoryRecord(xeroTenantId, batchPaymentID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createBatchPaymentHistoryRecord");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *batchPaymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for BatchPayment (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific batch payment
[apiInstance createBatchPaymentHistoryRecordWith:xeroTenantId
    batchPaymentID:batchPaymentID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const batchPaymentID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
    details: "Hello World" }; 

const historyRecords: HistoryRecords = {  
    historyRecords: [historyRecord] }; 

try {
  const response = await xero.accountingApi.createBatchPaymentHistoryRecord(xeroTenantId, batchPaymentID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateBatchPaymentHistoryRecordExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var batchPaymentID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateBatchPaymentHistoryRecordAsync(accessToken, xeroTenantId, batchPaymentID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateBatchPaymentHistoryRecord: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$batchPaymentID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createBatchPaymentHistoryRecord($xeroTenantId, $batchPaymentID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createBatchPaymentHistoryRecord: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $batchPaymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for BatchPayment
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createBatchPaymentHistoryRecord(xeroTenantId => $xeroTenantId, batchPaymentID => $batchPaymentID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createBatchPaymentHistoryRecord: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_batch_payment_history_record():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    batch_payment_id = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    historyRecords = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_batch_payment_history_record(xero_tenant_id, batch_payment_id, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createBatchPaymentHistoryRecord: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let batchPaymentID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createBatchPaymentHistoryRecord(xeroTenantId, batchPaymentID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
BatchPaymentID*
UUID (uuid)
Unique identifier for BatchPayment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createBrandingThemePaymentServices

Creates a new custom payment service for a specific branding theme


/BrandingThemes/{BrandingThemeID}/PaymentServices

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BrandingThemes/{BrandingThemeID}/PaymentServices"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID brandingThemeID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        PaymentService paymentService = new PaymentService();
        paymentService.setPaymentServiceID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        paymentService.setPaymentServiceName("ACME Payments");
        paymentService.setPaymentServiceUrl("https://www.payupnow.com/");
        paymentService.setPayNowText("Pay Now");

        try {
            PaymentServices result = apiInstance.createBrandingThemePaymentServices(accessToken, xeroTenantId, brandingThemeID, paymentService);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createBrandingThemePaymentServices");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID brandingThemeID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Branding Theme
        PaymentService paymentService = { "PaymentServiceID": "00000000-0000-0000-0000-000000000000", "PaymentServiceName": "ACME Payments", "PaymentServiceUrl": "https://www.payupnow.com/", "PayNowText": "Pay Now" }; // PaymentService | 
        try {
            PaymentServices result = apiInstance.createBrandingThemePaymentServices(xeroTenantId, brandingThemeID, paymentService);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createBrandingThemePaymentServices");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *brandingThemeID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Branding Theme (default to null)
PaymentService *paymentService = { "PaymentServiceID": "00000000-0000-0000-0000-000000000000", "PaymentServiceName": "ACME Payments", "PaymentServiceUrl": "https://www.payupnow.com/", "PayNowText": "Pay Now" }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a new custom payment service for a specific branding theme
[apiInstance createBrandingThemePaymentServicesWith:xeroTenantId
    brandingThemeID:brandingThemeID
    paymentService:paymentService
              completionHandler: ^(PaymentServices output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const brandingThemeID = '00000000-0000-0000-0000-000000000000';

const paymentService: PaymentService = { 
    paymentServiceID: "00000000-0000-0000-0000-000000000000",
    paymentServiceName: "ACME Payments",
    paymentServiceUrl: "https://www.payupnow.com/",
    payNowText: "Pay Now" }; 

try {
  const response = await xero.accountingApi.createBrandingThemePaymentServices(xeroTenantId, brandingThemeID, paymentService);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateBrandingThemePaymentServicesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var brandingThemeID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var paymentService = new PaymentService();
            paymentService.PaymentServiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            paymentService.PaymentServiceName = "ACME Payments";
            paymentService.PaymentServiceUrl = "https://www.payupnow.com/";
            paymentService.PayNowText = "Pay Now";
            
            try {
                var result = await apiInstance.CreateBrandingThemePaymentServicesAsync(accessToken, xeroTenantId, brandingThemeID, paymentService);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateBrandingThemePaymentServices: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$brandingThemeID = "00000000-0000-0000-0000-000000000000";

$paymentService = new XeroAPI\XeroPHP\Models\Accounting\PaymentService;
$paymentService->setPaymentServiceID('00000000-0000-0000-0000-000000000000');
$paymentService->setPaymentServiceName('ACME Payments');
$paymentService->setPaymentServiceUrl('https://www.payupnow.com/');
$paymentService->setPayNowText('Pay Now');

try {
  $result = $apiInstance->createBrandingThemePaymentServices($xeroTenantId, $brandingThemeID, $paymentService);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createBrandingThemePaymentServices: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $brandingThemeID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Branding Theme
my $paymentService = ::Object::PaymentService->new(); # PaymentService | 

eval { 
    my $result = $api_instance->createBrandingThemePaymentServices(xeroTenantId => $xeroTenantId, brandingThemeID => $brandingThemeID, paymentService => $paymentService);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createBrandingThemePaymentServices: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_branding_theme_payment_services():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    branding_theme_id = '00000000-0000-0000-0000-000000000000'

    payment_service = PaymentService(
        payment_service_id = "00000000-0000-0000-0000-000000000000",
        payment_service_name = "ACME Payments",
        payment_service_url = "https://www.payupnow.com/",
        pay_now_text = "Pay Now")
    
    try:
        api_response = api_instance.create_branding_theme_payment_services(xero_tenant_id, branding_theme_id, paymentService)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createBrandingThemePaymentServices: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let brandingThemeID = 00000000-0000-0000-0000-000000000000; // UUID
    let paymentService = { "PaymentServiceID": "00000000-0000-0000-0000-000000000000", "PaymentServiceName": "ACME Payments", "PaymentServiceUrl": "https://www.payupnow.com/", "PayNowText": "Pay Now" }; // PaymentService

    let mut context = AccountingApi::Context::default();
    let result = client.createBrandingThemePaymentServices(xeroTenantId, brandingThemeID, paymentService, &context).wait();
    println!("{:?}", result);

}

Scopes

paymentservices Grant read-write access to payment services

Parameters

Path parameters
Name Description
BrandingThemeID*
UUID (uuid)
Unique identifier for a Branding Theme
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
paymentService *
PaymentService
PaymentService object in body of request
Required

createContactAttachmentByFileName


/Contacts/{ContactID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts/{ContactID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.createContactAttachmentByFileName(accessToken, xeroTenantId, contactID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createContactAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.createContactAttachmentByFileName(xeroTenantId, contactID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createContactAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// 
[apiInstance createContactAttachmentByFileNameWith:xeroTenantId
    contactID:contactID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createContactAttachmentByFileName(xeroTenantId, contactID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateContactAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.CreateContactAttachmentByFileNameAsync(accessToken, xeroTenantId, contactID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateContactAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->createContactAttachmentByFileName($xeroTenantId, $contactID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createContactAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->createContactAttachmentByFileName(xeroTenantId => $xeroTenantId, contactID => $contactID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createContactAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_contact_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    contact_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.create_contact_attachment_by_file_name(xero_tenant_id, contact_id, file_name, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createContactAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.createContactAttachmentByFileName(xeroTenantId, contactID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
ContactID*
UUID (uuid)
Unique identifier for a Contact
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

createContactGroup

Creates a contact group


/ContactGroups

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ContactGroups"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        
        ContactGroup contactGroup = new ContactGroup();
        contactGroup.setName("VIPs");
        
        ContactGroups contactGroups = new ContactGroups();
        contactGroups.addContactGroupsItem(contactGroup);

        try {
            ContactGroups result = apiInstance.createContactGroup(accessToken, xeroTenantId, contactGroups);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createContactGroup");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        ContactGroups contactGroups = { "ContactGroups": [{ "Name": "VIPs" }]}; // ContactGroups | 
        try {
            ContactGroups result = apiInstance.createContactGroup(xeroTenantId, contactGroups);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createContactGroup");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
ContactGroups *contactGroups = { "ContactGroups": [{ "Name": "VIPs" }]}; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a contact group
[apiInstance createContactGroupWith:xeroTenantId
    contactGroups:contactGroups
              completionHandler: ^(ContactGroups output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';

const contactGroup: ContactGroup = { 
    name: "VIPs" }; 

const contactGroups: ContactGroups = {  
    contactGroups: [contactGroup] }; 

try {
  const response = await xero.accountingApi.createContactGroup(xeroTenantId, contactGroups);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateContactGroupExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";

            var contactGroup = new ContactGroup();
            contactGroup.Name = "VIPs";

            var contactGroups = new ContactGroups();
            var contactGroupsList = new List<ContactGroup>();
            contactGroupsList.Add(contactGroup); 
            contactGroups._ContactGroups = contactGroupsList;
            
            try {
                var result = await apiInstance.CreateContactGroupAsync(accessToken, xeroTenantId, contactGroups);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateContactGroup: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

$contactGroup = new XeroAPI\XeroPHP\Models\Accounting\ContactGroup;
$contactGroup->setName('VIPs');

$contactGroups = new XeroAPI\XeroPHP\Models\Accounting\ContactGroups;
$arr_contact_groups = [];
array_push($arr_contact_groups, $contactGroup);
$contactGroups->setContactGroups($arr_contact_groups);

try {
  $result = $apiInstance->createContactGroup($xeroTenantId, $contactGroups);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createContactGroup: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactGroups = ::Object::ContactGroups->new(); # ContactGroups | 

eval { 
    my $result = $api_instance->createContactGroup(xeroTenantId => $xeroTenantId, contactGroups => $contactGroups);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createContactGroup: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_contact_group():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'

    contact_group = ContactGroup(
        name = "VIPs")

    contactGroups = ContactGroups( 
        contact_groups = [contact_group])
    
    try:
        api_response = api_instance.create_contact_group(xero_tenant_id, contactGroups)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createContactGroup: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactGroups = { "ContactGroups": [{ "Name": "VIPs" }]}; // ContactGroups

    let mut context = AccountingApi::Context::default();
    let result = client.createContactGroup(xeroTenantId, contactGroups, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts Grant read-write access to contacts and contact groups

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
contactGroups *
ContactGroups
ContactGroups with an array of names in request body
Required

createContactGroupContacts

Creates contacts to a specific contact group


/ContactGroups/{ContactGroupID}/Contacts

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ContactGroups/{ContactGroupID}/Contacts"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID contactGroupID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        Contacts contacts = new Contacts();
        contacts.addContactsItem(contact);

        try {
            Contacts result = apiInstance.createContactGroupContacts(accessToken, xeroTenantId, contactGroupID, contacts);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createContactGroupContacts");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactGroupID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact Group
        Contacts contacts = { "Contacts": [ { "ContactID": "a3675fc4-f8dd-4f03-ba5b-f1870566bcd7" }, { "ContactID": "4e1753b9-018a-4775-b6aa-1bc7871cfee3" } ] }; // Contacts | 
        try {
            Contacts result = apiInstance.createContactGroupContacts(xeroTenantId, contactGroupID, contacts);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createContactGroupContacts");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactGroupID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact Group (default to null)
Contacts *contacts = { "Contacts": [ { "ContactID": "a3675fc4-f8dd-4f03-ba5b-f1870566bcd7" }, { "ContactID": "4e1753b9-018a-4775-b6aa-1bc7871cfee3" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates contacts to a specific contact group
[apiInstance createContactGroupContactsWith:xeroTenantId
    contactGroupID:contactGroupID
    contacts:contacts
              completionHandler: ^(Contacts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactGroupID = '00000000-0000-0000-0000-000000000000';

const contact: Contact = { 
    contactID: "00000000-0000-0000-0000-000000000000" }; 

const contacts: Contacts = {  
    contacts: [contact] }; 

try {
  const response = await xero.accountingApi.createContactGroupContacts(xeroTenantId, contactGroupID, contacts);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateContactGroupContactsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactGroupID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var contact = new Contact();
            contact.ContactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var contacts = new Contacts();
            var contactsList = new List<Contact>();
            contactsList.Add(contact); 
            contacts._Contacts = contactsList;
            
            try {
                var result = await apiInstance.CreateContactGroupContactsAsync(accessToken, xeroTenantId, contactGroupID, contacts);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateContactGroupContacts: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactGroupID = "00000000-0000-0000-0000-000000000000";

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$contacts = new XeroAPI\XeroPHP\Models\Accounting\Contacts;
$arr_contacts = [];
array_push($arr_contacts, $contact);
$contacts->setContacts($arr_contacts);

try {
  $result = $apiInstance->createContactGroupContacts($xeroTenantId, $contactGroupID, $contacts);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createContactGroupContacts: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactGroupID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact Group
my $contacts = ::Object::Contacts->new(); # Contacts | 

eval { 
    my $result = $api_instance->createContactGroupContacts(xeroTenantId => $xeroTenantId, contactGroupID => $contactGroupID, contacts => $contacts);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createContactGroupContacts: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_contact_group_contacts():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    contact_group_id = '00000000-0000-0000-0000-000000000000'

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    contacts = Contacts( 
        contacts = [contact])
    
    try:
        api_response = api_instance.create_contact_group_contacts(xero_tenant_id, contact_group_id, contacts)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createContactGroupContacts: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactGroupID = 00000000-0000-0000-0000-000000000000; // UUID
    let contacts = { "Contacts": [ { "ContactID": "a3675fc4-f8dd-4f03-ba5b-f1870566bcd7" }, { "ContactID": "4e1753b9-018a-4775-b6aa-1bc7871cfee3" } ] }; // Contacts

    let mut context = AccountingApi::Context::default();
    let result = client.createContactGroupContacts(xeroTenantId, contactGroupID, contacts, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts Grant read-write access to contacts and contact groups

Parameters

Path parameters
Name Description
ContactGroupID*
UUID (uuid)
Unique identifier for a Contact Group
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
contacts *
Contacts
Contacts with array of contacts specifying the ContactID to be added to ContactGroup in body of request
Required

createContactHistory

Creates a new history record for a specific contact


/Contacts/{ContactID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts/{ContactID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createContactHistory(accessToken, xeroTenantId, contactID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createContactHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createContactHistory(xeroTenantId, contactID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createContactHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a new history record for a specific contact
[apiInstance createContactHistoryWith:xeroTenantId
    contactID:contactID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
    details: "Hello World" }; 

const historyRecords: HistoryRecords = {  
    historyRecords: [historyRecord] }; 

try {
  const response = await xero.accountingApi.createContactHistory(xeroTenantId, contactID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateContactHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateContactHistoryAsync(accessToken, xeroTenantId, contactID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateContactHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createContactHistory($xeroTenantId, $contactID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createContactHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createContactHistory(xeroTenantId => $xeroTenantId, contactID => $contactID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createContactHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_contact_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    contact_id = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    historyRecords = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_contact_history(xero_tenant_id, contact_id, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createContactHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createContactHistory(xeroTenantId, contactID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts Grant read-write access to contacts and contact groups

Parameters

Path parameters
Name Description
ContactID*
UUID (uuid)
Unique identifier for a Contact
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createContacts

Creates multiple contacts (bulk) in a Xero organisation


/Contacts

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        Boolean summarizeErrors = true;
        
        Phone phone = new Phone();
        phone.setPhoneNumber("555-1212");
        phone.setPhoneType(com.xero.models.accounting.Phone.PhoneTypeEnum.MOBILE);

        List<Phone> phones = new ArrayList<Phone>();
        phones.add(phone);
        
        Contact contact = new Contact();
        contact.setName("Bruce Banner");
        contact.setEmailAddress("hulk@avengers.com");
        contact.setPhones(phones);
        
        Contacts contacts = new Contacts();
        contacts.addContactsItem(contact);

        try {
            Contacts result = apiInstance.createContacts(accessToken, xeroTenantId, contacts, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createContacts");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Contacts contacts = { "Id": "e997d6d7-6dad-4458-beb8-d9c1bf7f2edf", "Status": "OK", "ProviderName": "Xero API Partner", "DateTimeUTC": "/Date(1551399321121)/", "Contacts": [ { "ContactID": "3ff6d40c-af9a-40a3-89ce-3c1556a25591", "ContactStatus": "ACTIVE", "Name": "Foo9987", "EmailAddress": "sid32476@blah.com", "BankAccountDetails": "", "Addresses": [ { "AddressType": "STREET", "City": "", "Region": "", "PostalCode": "", "Country": "" }, { "AddressType": "POBOX", "City": "", "Region": "", "PostalCode": "", "Country": "" } ], "Phones": [ { "PhoneType": "DEFAULT", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "DDI", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "FAX", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "MOBILE", "PhoneNumber": "555-1212", "PhoneAreaCode": "415", "PhoneCountryCode": "" } ], "UpdatedDateUTC": "/Date(1551399321043+0000)/", "ContactGroups": [], "IsSupplier": false, "IsCustomer": false, "SalesTrackingCategories": [], "PurchasesTrackingCategories": [], "PaymentTerms": { "Bills": { "Day": 15, "Type": "OFCURRENTMONTH" }, "Sales": { "Day": 10, "Type": "DAYSAFTERBILLMONTH" } }, "ContactPersons": [], "HasValidationErrors": false } ] }; // Contacts | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            Contacts result = apiInstance.createContacts(xeroTenantId, contacts, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createContacts");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Contacts *contacts = { "Id": "e997d6d7-6dad-4458-beb8-d9c1bf7f2edf", "Status": "OK", "ProviderName": "Xero API Partner", "DateTimeUTC": "/Date(1551399321121)/", "Contacts": [ { "ContactID": "3ff6d40c-af9a-40a3-89ce-3c1556a25591", "ContactStatus": "ACTIVE", "Name": "Foo9987", "EmailAddress": "sid32476@blah.com", "BankAccountDetails": "", "Addresses": [ { "AddressType": "STREET", "City": "", "Region": "", "PostalCode": "", "Country": "" }, { "AddressType": "POBOX", "City": "", "Region": "", "PostalCode": "", "Country": "" } ], "Phones": [ { "PhoneType": "DEFAULT", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "DDI", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "FAX", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "MOBILE", "PhoneNumber": "555-1212", "PhoneAreaCode": "415", "PhoneCountryCode": "" } ], "UpdatedDateUTC": "/Date(1551399321043+0000)/", "ContactGroups": [], "IsSupplier": false, "IsCustomer": false, "SalesTrackingCategories": [], "PurchasesTrackingCategories": [], "PaymentTerms": { "Bills": { "Day": 15, "Type": "OFCURRENTMONTH" }, "Sales": { "Day": 10, "Type": "DAYSAFTERBILLMONTH" } }, "ContactPersons": [], "HasValidationErrors": false } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates multiple contacts (bulk) in a Xero organisation
[apiInstance createContactsWith:xeroTenantId
    contacts:contacts
    summarizeErrors:summarizeErrors
              completionHandler: ^(Contacts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;

const phone: Phone = { 
    phoneNumber: "555-1212",
    phoneType: Phone.PhoneTypeEnum.MOBILE };   
const phones = [];    
phones.push(phone)

const contact: Contact = { 
    name: "Bruce Banner",
    emailAddress: "hulk@avengers.com",
    phones: phones }; 

const contacts: Contacts = {  
    contacts: [contact] }; 

try {
  const response = await xero.accountingApi.createContacts(xeroTenantId, contacts,  summarizeErrors);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateContactsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;

            var phone = new Phone();
            phone.PhoneNumber = "555-1212";
            phone.PhoneType = Phone.PhoneTypeEnum.MOBILE;
            var phones = new List<Phone>();
            phones.Add(phone);

            var contact = new Contact();
            contact.Name = "Bruce Banner";
            contact.EmailAddress = "hulk@avengers.com";
            contact.Phones = phones;

            var contacts = new Contacts();
            var contactsList = new List<Contact>();
            contactsList.Add(contact); 
            contacts._Contacts = contactsList;
            
            try {
                var result = await apiInstance.CreateContactsAsync(accessToken, xeroTenantId, contacts, summarizeErrors);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateContacts: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;

$phone = new XeroAPI\XeroPHP\Models\Accounting\Phone;
$phone->setPhoneNumber('555-1212');
$phone->setPhoneType(XeroAPI\XeroPHP\Models\Accounting\Phone::PHONE_TYPE_MOBILE);
$phones = [];
array_push($phones, $phone);

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setName('Bruce Banner');
$contact->setEmailAddress('hulk@avengers.com');
$contact->setPhones($phones);

$contacts = new XeroAPI\XeroPHP\Models\Accounting\Contacts;
$arr_contacts = [];
array_push($arr_contacts, $contact);
$contacts->setContacts($arr_contacts);

try {
  $result = $apiInstance->createContacts($xeroTenantId, $contacts, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createContacts: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contacts = ::Object::Contacts->new(); # Contacts | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->createContacts(xeroTenantId => $xeroTenantId, contacts => $contacts, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createContacts: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_contacts():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'

    phone = Phone(
        phone_number = "555-1212",
        phone_type = "MOBILE")
    
    phones = []    
    phones.append(phone)

    contact = Contact(
        name = "Bruce Banner",
        email_address = "hulk@avengers.com",
        phones = phones)

    contacts = Contacts( 
        contacts = [contact])
    
    try:
        api_response = api_instance.create_contacts(xero_tenant_id, contacts, summarize_errors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createContacts: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contacts = { "Id": "e997d6d7-6dad-4458-beb8-d9c1bf7f2edf", "Status": "OK", "ProviderName": "Xero API Partner", "DateTimeUTC": "/Date(1551399321121)/", "Contacts": [ { "ContactID": "3ff6d40c-af9a-40a3-89ce-3c1556a25591", "ContactStatus": "ACTIVE", "Name": "Foo9987", "EmailAddress": "sid32476@blah.com", "BankAccountDetails": "", "Addresses": [ { "AddressType": "STREET", "City": "", "Region": "", "PostalCode": "", "Country": "" }, { "AddressType": "POBOX", "City": "", "Region": "", "PostalCode": "", "Country": "" } ], "Phones": [ { "PhoneType": "DEFAULT", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "DDI", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "FAX", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "MOBILE", "PhoneNumber": "555-1212", "PhoneAreaCode": "415", "PhoneCountryCode": "" } ], "UpdatedDateUTC": "/Date(1551399321043+0000)/", "ContactGroups": [], "IsSupplier": false, "IsCustomer": false, "SalesTrackingCategories": [], "PurchasesTrackingCategories": [], "PaymentTerms": { "Bills": { "Day": 15, "Type": "OFCURRENTMONTH" }, "Sales": { "Day": 10, "Type": "DAYSAFTERBILLMONTH" } }, "ContactPersons": [], "HasValidationErrors": false } ] }; // Contacts
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.createContacts(xeroTenantId, contacts, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts Grant read-write access to contacts and contact groups

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
contacts *
Contacts
Contacts with an array of Contact objects to create in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

createCreditNoteAllocation

Creates allocation for a specific credit note


/CreditNotes/{CreditNoteID}/Allocations

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes/{CreditNoteID}/Allocations?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID creditNoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Boolean summarizeErrors = true;
        LocalDate currDate = LocalDate.now();
        
        Invoice invoice = new Invoice();
        invoice.setInvoiceID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        Allocation allocation = new Allocation();
        allocation.setAmount(1.0);
        allocation.setDate(currDate);
        allocation.setInvoice(invoice);
        
        Allocations allocations = new Allocations();
        allocations.addAllocationsItem(allocation);

        try {
            Allocations result = apiInstance.createCreditNoteAllocation(accessToken, xeroTenantId, creditNoteID, allocations, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createCreditNoteAllocation");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Credit Note
        Allocations allocations = { "Allocations": [ { "Invoice": { "LineItems": [], "InvoiceID": "c45720a1-ade3-4a38-a064-d15489be6841" }, "Amount": 1, "Date": "2019-03-05" } ] }; // Allocations | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            Allocations result = apiInstance.createCreditNoteAllocation(xeroTenantId, creditNoteID, allocations, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createCreditNoteAllocation");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *creditNoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Credit Note (default to null)
Allocations *allocations = { "Allocations": [ { "Invoice": { "LineItems": [], "InvoiceID": "c45720a1-ade3-4a38-a064-d15489be6841" }, "Amount": 1, "Date": "2019-03-05" } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates allocation for a specific credit note
[apiInstance createCreditNoteAllocationWith:xeroTenantId
    creditNoteID:creditNoteID
    allocations:allocations
    summarizeErrors:summarizeErrors
              completionHandler: ^(Allocations output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const creditNoteID = '00000000-0000-0000-0000-000000000000';
const summarizeErrors = true;
const currDate = '2020-12-10'

const invoice: Invoice = { 
    invoiceID: "00000000-0000-0000-0000-000000000000" }; 

const allocation: Allocation = { 
    amount: 1.0,
    date: currDate,
    invoice: invoice }; 

const allocations: Allocations = {  
    allocations: [allocation] }; 

try {
  const response = await xero.accountingApi.createCreditNoteAllocation(xeroTenantId, creditNoteID, allocations,  summarizeErrors);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateCreditNoteAllocationExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var creditNoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var summarizeErrors = true;
            var currDate = DateTime.Now;

            var invoice = new Invoice();
            invoice.InvoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var allocation = new Allocation();
            allocation.Amount = new decimal(1.0);
            allocation.Date = currDate;
            allocation.Invoice = invoice;

            var allocations = new Allocations();
            var allocationsList = new List<Allocation>();
            allocationsList.Add(allocation); 
            allocations._Allocations = allocationsList;
            
            try {
                var result = await apiInstance.CreateCreditNoteAllocationAsync(accessToken, xeroTenantId, creditNoteID, allocations, summarizeErrors);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateCreditNoteAllocation: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$creditNoteID = "00000000-0000-0000-0000-000000000000";
$summarizeErrors = true;
$currDate = new DateTime('2020-12-10');

$invoice = new XeroAPI\XeroPHP\Models\Accounting\Invoice;
$invoice->setInvoiceID('00000000-0000-0000-0000-000000000000');

$allocation = new XeroAPI\XeroPHP\Models\Accounting\Allocation;
$allocation->setAmount(1.0);
$allocation->setDate($currDate);
$allocation->setInvoice($invoice);

$allocations = new XeroAPI\XeroPHP\Models\Accounting\Allocations;
$arr_allocations = [];
array_push($arr_allocations, $allocation);
$allocations->setAllocations($arr_allocations);

try {
  $result = $apiInstance->createCreditNoteAllocation($xeroTenantId, $creditNoteID, $allocations, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createCreditNoteAllocation: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Credit Note
my $allocations = ::Object::Allocations->new(); # Allocations | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->createCreditNoteAllocation(xeroTenantId => $xeroTenantId, creditNoteID => $creditNoteID, allocations => $allocations, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createCreditNoteAllocation: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_credit_note_allocation():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    credit_note_id = '00000000-0000-0000-0000-000000000000'
    summarize_errors = 'True'
    curr_date = dateutil.parser.parse('2020-12-03T00:00:00Z')

    invoice = Invoice(
        invoiceID = "00000000-0000-0000-0000-000000000000")

    allocation = Allocation(
        amount = 1.0,
        date = curr_date,
        invoice = invoice)

    allocations = Allocations( 
        allocations = [allocation])
    
    try:
        api_response = api_instance.create_credit_note_allocation(xero_tenant_id, credit_note_id, allocations, summarize_errors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createCreditNoteAllocation: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let allocations = { "Allocations": [ { "Invoice": { "LineItems": [], "InvoiceID": "c45720a1-ade3-4a38-a064-d15489be6841" }, "Amount": 1, "Date": "2019-03-05" } ] }; // Allocations
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.createCreditNoteAllocation(xeroTenantId, creditNoteID, allocations, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
CreditNoteID*
UUID (uuid)
Unique identifier for a Credit Note
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
allocations *
Allocations
Allocations with array of Allocation object in body of request.
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

createCreditNoteAttachmentByFileName

Creates an attachment for a specific credit note


/CreditNotes/{CreditNoteID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes/{CreditNoteID}/Attachments/{FileName}?IncludeOnline=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID creditNoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        Boolean includeOnline = true;
        
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.createCreditNoteAttachmentByFileName(accessToken, xeroTenantId, creditNoteID, fileName, body, includeOnline, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createCreditNoteAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Credit Note
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        Boolean includeOnline = true; // Boolean | Allows an attachment to be seen by the end customer within their online invoice
        try {
            Attachments result = apiInstance.createCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, body, includeOnline);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createCreditNoteAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *creditNoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Credit Note (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 
Boolean *includeOnline = true; // Allows an attachment to be seen by the end customer within their online invoice (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates an attachment for a specific credit note
[apiInstance createCreditNoteAttachmentByFileNameWith:xeroTenantId
    creditNoteID:creditNoteID
    fileName:fileName
    body:body
    includeOnline:includeOnline
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const creditNoteID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const includeOnline = true;
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, body,  includeOnline, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateCreditNoteAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var creditNoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            var includeOnline = true;
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.CreateCreditNoteAttachmentByFileNameAsync(accessToken, xeroTenantId, creditNoteID, fileName, body, includeOnline);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateCreditNoteAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$creditNoteID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$includeOnline = true;

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->createCreditNoteAttachmentByFileName($xeroTenantId, $creditNoteID, $fileName, $body, $includeOnline);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createCreditNoteAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Credit Note
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 
my $includeOnline = true; # Boolean | Allows an attachment to be seen by the end customer within their online invoice

eval { 
    my $result = $api_instance->createCreditNoteAttachmentByFileName(xeroTenantId => $xeroTenantId, creditNoteID => $creditNoteID, fileName => $fileName, body => $body, includeOnline => $includeOnline);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createCreditNoteAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_credit_note_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    credit_note_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    include_online = 'true'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.create_credit_note_attachment_by_file_name(xero_tenant_id, credit_note_id, file_name, body, include_online)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createCreditNoteAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]
    let includeOnline = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.createCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, body, includeOnline, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
CreditNoteID*
UUID (uuid)
Unique identifier for a Credit Note
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required
Query parameters
Name Description
IncludeOnline
Boolean
Allows an attachment to be seen by the end customer within their online invoice

createCreditNoteHistory

Retrieves history records of a specific credit note


/CreditNotes/{CreditNoteID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes/{CreditNoteID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID creditNoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createCreditNoteHistory(accessToken, xeroTenantId, creditNoteID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createCreditNoteHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Credit Note
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createCreditNoteHistory(xeroTenantId, creditNoteID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createCreditNoteHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *creditNoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Credit Note (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history records of a specific credit note
[apiInstance createCreditNoteHistoryWith:xeroTenantId
    creditNoteID:creditNoteID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const creditNoteID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
    details: "Hello World" }; 

const historyRecords: HistoryRecords = {  
    historyRecords: [historyRecord] }; 

try {
  const response = await xero.accountingApi.createCreditNoteHistory(xeroTenantId, creditNoteID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateCreditNoteHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var creditNoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateCreditNoteHistoryAsync(accessToken, xeroTenantId, creditNoteID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateCreditNoteHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$creditNoteID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createCreditNoteHistory($xeroTenantId, $creditNoteID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createCreditNoteHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Credit Note
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createCreditNoteHistory(xeroTenantId => $xeroTenantId, creditNoteID => $creditNoteID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createCreditNoteHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_credit_note_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    credit_note_id = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    historyRecords = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_credit_note_history(xero_tenant_id, credit_note_id, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createCreditNoteHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createCreditNoteHistory(xeroTenantId, creditNoteID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
CreditNoteID*
UUID (uuid)
Unique identifier for a Credit Note
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createCreditNotes

Creates a new credit note


/CreditNotes

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes?summarizeErrors=true&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        Boolean summarizeErrors = true;
        Integer unitdp = 4;
        LocalDate currDate = LocalDate.now();
        
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");

        List<LineItem> lineItems = new ArrayList<LineItem>();
        lineItems.add(lineItem);
        
        CreditNote creditNote = new CreditNote();
        creditNote.setType(com.xero.models.accounting.CreditNote.TypeEnum.ACCPAYCREDIT);
        creditNote.setContact(contact);
        creditNote.setDate(currDate);
        creditNote.setLineItems(lineItems);
        
        CreditNotes creditNotes = new CreditNotes();
        creditNotes.addCreditNotesItem(creditNote);

        try {
            CreditNotes result = apiInstance.createCreditNotes(accessToken, xeroTenantId, creditNotes, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createCreditNotes");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        CreditNotes creditNotes = { "CreditNotes":[ { "Type":"ACCPAYCREDIT", "Contact":{ "ContactID":"430fa14a-f945-44d3-9f97-5df5e28441b8" }, "Date":"2019-01-05", "LineItems":[ { "Description":"Foobar", "Quantity":2.0, "UnitAmount":20.0, "AccountCode":"400" } ] } ] }; // CreditNotes | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            CreditNotes result = apiInstance.createCreditNotes(xeroTenantId, creditNotes, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createCreditNotes");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
CreditNotes *creditNotes = { "CreditNotes":[ { "Type":"ACCPAYCREDIT", "Contact":{ "ContactID":"430fa14a-f945-44d3-9f97-5df5e28441b8" }, "Date":"2019-01-05", "LineItems":[ { "Description":"Foobar", "Quantity":2.0, "UnitAmount":20.0, "AccountCode":"400" } ] } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a new credit note
[apiInstance createCreditNotesWith:xeroTenantId
    creditNotes:creditNotes
    summarizeErrors:summarizeErrors
    unitdp:unitdp
              completionHandler: ^(CreditNotes output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;
const unitdp = 4;
const currDate = '2020-12-10'

const contact: Contact = { 
    contactID: "00000000-0000-0000-0000-000000000000" }; 

const lineItem: LineItem = { 
    description: "Foobar",
    quantity: 1.0,
    unitAmount: 20.0,
    accountCode: "000" };   
const lineItems = [];    
lineItems.push(lineItem)

const creditNote: CreditNote = { 
    type: CreditNote.TypeEnum.ACCPAYCREDIT,
    contact: contact,
    date: currDate,
    lineItems: lineItems }; 

const creditNotes: CreditNotes = {  
    creditNotes: [creditNote] }; 

try {
  const response = await xero.accountingApi.createCreditNotes(xeroTenantId, creditNotes,  summarizeErrors, unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateCreditNotesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;
            var unitdp = 4;
            var currDate = DateTime.Now;

            var contact = new Contact();
            contact.ContactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var lineItem = new LineItem();
            lineItem.Description = "Foobar";
            lineItem.Quantity = new decimal(1.0);
            lineItem.UnitAmount = new decimal(20.0);
            lineItem.AccountCode = "000";
            var lineItems = new List<LineItem>();
            lineItems.Add(lineItem);

            var creditNote = new CreditNote();
            creditNote.Type = CreditNote.TypeEnum.ACCPAYCREDIT;
            creditNote.Contact = contact;
            creditNote.Date = currDate;
            creditNote.LineItems = lineItems;

            var creditNotes = new CreditNotes();
            var creditNotesList = new List<CreditNote>();
            creditNotesList.Add(creditNote); 
            creditNotes._CreditNotes = creditNotesList;
            
            try {
                var result = await apiInstance.CreateCreditNotesAsync(accessToken, xeroTenantId, creditNotes, summarizeErrors, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateCreditNotes: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$unitdp = 4;
$currDate = new DateTime('2020-12-10');

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItems = [];
array_push($lineItems, $lineItem);

$creditNote = new XeroAPI\XeroPHP\Models\Accounting\CreditNote;
$creditNote->setType(XeroAPI\XeroPHP\Models\Accounting\CreditNote::TYPE_ACCPAYCREDIT);
$creditNote->setContact($contact);
$creditNote->setDate($currDate);
$creditNote->setLineItems($lineItems);

$creditNotes = new XeroAPI\XeroPHP\Models\Accounting\CreditNotes;
$arr_credit_notes = [];
array_push($arr_credit_notes, $creditNote);
$creditNotes->setCreditNotes($arr_credit_notes);

try {
  $result = $apiInstance->createCreditNotes($xeroTenantId, $creditNotes, $summarizeErrors, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createCreditNotes: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNotes = ::Object::CreditNotes->new(); # CreditNotes | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->createCreditNotes(xeroTenantId => $xeroTenantId, creditNotes => $creditNotes, summarizeErrors => $summarizeErrors, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createCreditNotes: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_credit_notes():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'
    curr_date = dateutil.parser.parse('2020-12-03T00:00:00Z')

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000")
    
    line_items = []    
    line_items.append(line_item)

    credit_note = CreditNote(
        type = "ACCPAYCREDIT",
        contact = contact,
        date = curr_date,
        line_items = line_items)

    creditNotes = CreditNotes( 
        credit_notes = [credit_note])
    
    try:
        api_response = api_instance.create_credit_notes(xero_tenant_id, creditNotes, summarize_errors, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createCreditNotes: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNotes = { "CreditNotes":[ { "Type":"ACCPAYCREDIT", "Contact":{ "ContactID":"430fa14a-f945-44d3-9f97-5df5e28441b8" }, "Date":"2019-01-05", "LineItems":[ { "Description":"Foobar", "Quantity":2.0, "UnitAmount":20.0, "AccountCode":"400" } ] } ] }; // CreditNotes
    let summarizeErrors = true; // Boolean
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.createCreditNotes(xeroTenantId, creditNotes, summarizeErrors, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
creditNotes *
CreditNotes
Credit Notes with array of CreditNote object in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

createCurrency

Create a new currency for a Xero organisation


/Currencies

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Currencies"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        
        Currency currency = new Currency();
        currency.setCode(com.xero.models.accounting.CurrencyCode.USD);
        currency.setDescription("United States Dollar");

        try {
            Currencies result = apiInstance.createCurrency(accessToken, xeroTenantId, currency);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createCurrency");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Currency currency = { "Code": "USD", "Description": "United States Dollar" }; // Currency | 
        try {
            Currencies result = apiInstance.createCurrency(xeroTenantId, currency);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createCurrency");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Currency *currency = { "Code": "USD", "Description": "United States Dollar" }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Create a new currency for a Xero organisation
[apiInstance createCurrencyWith:xeroTenantId
    currency:currency
              completionHandler: ^(Currencies output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';

const currency: Currency = { 
    code: CurrencyCode.USD,
    description: "United States Dollar" }; 

try {
  const response = await xero.accountingApi.createCurrency(xeroTenantId, currency);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateCurrencyExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";

            var currency = new Currency();
            currency.Code = CurrencyCode.USD;
            currency.Description = "United States Dollar";
            
            try {
                var result = await apiInstance.CreateCurrencyAsync(accessToken, xeroTenantId, currency);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateCurrency: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

$currency = new XeroAPI\XeroPHP\Models\Accounting\Currency;
$currency->setCode(XeroAPI\XeroPHP\Models\Accounting\CurrencyCode::USD);
$currency->setDescription('United States Dollar');

try {
  $result = $apiInstance->createCurrency($xeroTenantId, $currency);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createCurrency: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $currency = ::Object::Currency->new(); # Currency | 

eval { 
    my $result = $api_instance->createCurrency(xeroTenantId => $xeroTenantId, currency => $currency);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createCurrency: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_currency():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'

    currency = Currency(
        code = CurrencyCode.USD,
        description = "United States Dollar")
    
    try:
        api_response = api_instance.create_currency(xero_tenant_id, currency)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createCurrency: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let currency = { "Code": "USD", "Description": "United States Dollar" }; // Currency

    let mut context = AccountingApi::Context::default();
    let result = client.createCurrency(xeroTenantId, currency, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
currency *
Currency
Currency object in the body of request
Required

createEmployees

Creates new employees used in Xero payrun


/Employees

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Employees?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        Boolean summarizeErrors = true;
        
        Employee employee = new Employee();
        employee.setFirstName("Nick");
        employee.setLastName("Fury");
        
        Employees employees = new Employees();
        employees.addEmployeesItem(employee);

        try {
            Employees result = apiInstance.createEmployees(accessToken, xeroTenantId, employees, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createEmployees");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Employees employees = { "Employees": [ { "FirstName": "Nick", "LastName": "Fury", "ExternalLink": { "Url": "http://twitter.com/#!/search/Nick+Fury" } } ] }; // Employees | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            Employees result = apiInstance.createEmployees(xeroTenantId, employees, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createEmployees");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Employees *employees = { "Employees": [ { "FirstName": "Nick", "LastName": "Fury", "ExternalLink": { "Url": "http://twitter.com/#!/search/Nick+Fury" } } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates new employees used in Xero payrun
[apiInstance createEmployeesWith:xeroTenantId
    employees:employees
    summarizeErrors:summarizeErrors
              completionHandler: ^(Employees output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;

const employee: Employee = { 
    firstName: "Nick",
    lastName: "Fury" }; 

const employees: Employees = {  
    employees: [employee] }; 

try {
  const response = await xero.accountingApi.createEmployees(xeroTenantId, employees,  summarizeErrors);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateEmployeesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;

            var employee = new Employee();
            employee.FirstName = "Nick";
            employee.LastName = "Fury";

            var employees = new Employees();
            var employeesList = new List<Employee>();
            employeesList.Add(employee); 
            employees._Employees = employeesList;
            
            try {
                var result = await apiInstance.CreateEmployeesAsync(accessToken, xeroTenantId, employees, summarizeErrors);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateEmployees: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;

$employee = new XeroAPI\XeroPHP\Models\Accounting\Employee;
$employee->setFirstName('Nick');
$employee->setLastName('Fury');

$employees = new XeroAPI\XeroPHP\Models\Accounting\Employees;
$arr_employees = [];
array_push($arr_employees, $employee);
$employees->setEmployees($arr_employees);

try {
  $result = $apiInstance->createEmployees($xeroTenantId, $employees, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createEmployees: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $employees = ::Object::Employees->new(); # Employees | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->createEmployees(xeroTenantId => $xeroTenantId, employees => $employees, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createEmployees: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_employees():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'

    employee = Employee(
        first_name = "Nick",
        last_name = "Fury")

    employees = Employees( 
        employees = [employee])
    
    try:
        api_response = api_instance.create_employees(xero_tenant_id, employees, summarize_errors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createEmployees: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let employees = { "Employees": [ { "FirstName": "Nick", "LastName": "Fury", "ExternalLink": { "Url": "http://twitter.com/#!/search/Nick+Fury" } } ] }; // Employees
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.createEmployees(xeroTenantId, employees, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
employees *
Employees
Employees with array of Employee object in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

createExpenseClaimHistory

Creates a history record for a specific expense claim


/ExpenseClaims/{ExpenseClaimID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ExpenseClaims/{ExpenseClaimID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID expenseClaimID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createExpenseClaimHistory(accessToken, xeroTenantId, expenseClaimID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createExpenseClaimHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID expenseClaimID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a ExpenseClaim
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createExpenseClaimHistory(xeroTenantId, expenseClaimID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createExpenseClaimHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *expenseClaimID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a ExpenseClaim (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific expense claim
[apiInstance createExpenseClaimHistoryWith:xeroTenantId
    expenseClaimID:expenseClaimID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const expenseClaimID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
    details: "Hello World" }; 

const historyRecords: HistoryRecords = {  
    historyRecords: [historyRecord] }; 

try {
  const response = await xero.accountingApi.createExpenseClaimHistory(xeroTenantId, expenseClaimID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateExpenseClaimHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var expenseClaimID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateExpenseClaimHistoryAsync(accessToken, xeroTenantId, expenseClaimID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateExpenseClaimHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$expenseClaimID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createExpenseClaimHistory($xeroTenantId, $expenseClaimID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createExpenseClaimHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $expenseClaimID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a ExpenseClaim
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createExpenseClaimHistory(xeroTenantId => $xeroTenantId, expenseClaimID => $expenseClaimID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createExpenseClaimHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_expense_claim_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    expense_claim_id = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    historyRecords = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_expense_claim_history(xero_tenant_id, expense_claim_id, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createExpenseClaimHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let expenseClaimID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createExpenseClaimHistory(xeroTenantId, expenseClaimID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
ExpenseClaimID*
UUID (uuid)
Unique identifier for a ExpenseClaim
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createExpenseClaims

Creates expense claims


/ExpenseClaims

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ExpenseClaims"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        LocalDate currDate = LocalDate.now();
        
        User user = new User();
        user.setUserID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        Receipt receipt = new Receipt();
        receipt.setReceiptID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        receipt.setDate(currDate);

        List<Receipt> receipts = new ArrayList<Receipt>();
        receipts.add(receipt);
        
        ExpenseClaim expenseClaim = new ExpenseClaim();
        expenseClaim.setStatus(com.xero.models.accounting.ExpenseClaim.StatusEnum.SUBMITTED);
        expenseClaim.setUser(user);
        expenseClaim.setReceipts(receipts);
        
        ExpenseClaims expenseClaims = new ExpenseClaims();
        expenseClaims.addExpenseClaimsItem(expenseClaim);

        try {
            ExpenseClaims result = apiInstance.createExpenseClaims(accessToken, xeroTenantId, expenseClaims);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createExpenseClaims");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        ExpenseClaims expenseClaims = { "ExpenseClaims": [ { "Status": "SUBMITTED", "User": { "UserID": "d1164823-0ac1-41ad-987b-b4e30fe0b273" }, "Receipts": [ { "Lineitems": [], "ReceiptID": "dc1c7f6d-0a4c-402f-acac-551d62ce5816" } ] } ] }; // ExpenseClaims | 
        try {
            ExpenseClaims result = apiInstance.createExpenseClaims(xeroTenantId, expenseClaims);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createExpenseClaims");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
ExpenseClaims *expenseClaims = { "ExpenseClaims": [ { "Status": "SUBMITTED", "User": { "UserID": "d1164823-0ac1-41ad-987b-b4e30fe0b273" }, "Receipts": [ { "Lineitems": [], "ReceiptID": "dc1c7f6d-0a4c-402f-acac-551d62ce5816" } ] } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates expense claims
[apiInstance createExpenseClaimsWith:xeroTenantId
    expenseClaims:expenseClaims
              completionHandler: ^(ExpenseClaims output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const currDate = '2020-12-10'

const user: User = { 
    userID: "00000000-0000-0000-0000-000000000000" }; 

const receipt: Receipt = { 
    receiptID: "00000000-0000-0000-0000-000000000000",
    date: currDate };   
const receipts = [];    
receipts.push(receipt)

const expenseClaim: ExpenseClaim = { 
    status: ExpenseClaim.StatusEnum.SUBMITTED,
    user: user,
    receipts: receipts }; 

const expenseClaims: ExpenseClaims = {  
    expenseClaims: [expenseClaim] }; 

try {
  const response = await xero.accountingApi.createExpenseClaims(xeroTenantId, expenseClaims);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateExpenseClaimsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var currDate = DateTime.Now;

            var user = new User();
            user.UserID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var receipt = new Receipt();
            receipt.ReceiptID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            receipt.Date = currDate;
            var receipts = new List<Receipt>();
            receipts.Add(receipt);

            var expenseClaim = new ExpenseClaim();
            expenseClaim.Status = ExpenseClaim.StatusEnum.SUBMITTED;
            expenseClaim.User = user;
            expenseClaim.Receipts = receipts;

            var expenseClaims = new ExpenseClaims();
            var expenseClaimsList = new List<ExpenseClaim>();
            expenseClaimsList.Add(expenseClaim); 
            expenseClaims._ExpenseClaims = expenseClaimsList;
            
            try {
                var result = await apiInstance.CreateExpenseClaimsAsync(accessToken, xeroTenantId, expenseClaims);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateExpenseClaims: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$currDate = new DateTime('2020-12-10');

$user = new XeroAPI\XeroPHP\Models\Accounting\User;
$user->setUserID('00000000-0000-0000-0000-000000000000');

$receipt = new XeroAPI\XeroPHP\Models\Accounting\Receipt;
$receipt->setReceiptID('00000000-0000-0000-0000-000000000000');
$receipt->setDate($currDate);
$receipts = [];
array_push($receipts, $receipt);

$expenseClaim = new XeroAPI\XeroPHP\Models\Accounting\ExpenseClaim;
$expenseClaim->setStatus(XeroAPI\XeroPHP\Models\Accounting\ExpenseClaim::STATUS_SUBMITTED);
$expenseClaim->setUser($user);
$expenseClaim->setReceipts($receipts);

$expenseClaims = new XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims;
$arr_expense_claims = [];
array_push($arr_expense_claims, $expenseClaim);
$expenseClaims->setExpenseClaims($arr_expense_claims);

try {
  $result = $apiInstance->createExpenseClaims($xeroTenantId, $expenseClaims);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createExpenseClaims: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $expenseClaims = ::Object::ExpenseClaims->new(); # ExpenseClaims | 

eval { 
    my $result = $api_instance->createExpenseClaims(xeroTenantId => $xeroTenantId, expenseClaims => $expenseClaims);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createExpenseClaims: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_expense_claims():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    curr_date = dateutil.parser.parse('2020-12-03T00:00:00Z')

    user = User(
        user_id = "00000000-0000-0000-0000-000000000000")

    receipt = Receipt(
        receipt_id = "00000000-0000-0000-0000-000000000000",
        date = curr_date)
    
    receipts = []    
    receipts.append(receipt)

    expense_claim = ExpenseClaim(
        status = "SUBMITTED",
        user = user,
        receipts = receipts)

    expenseClaims = ExpenseClaims( 
        expense_claims = [expense_claim])
    
    try:
        api_response = api_instance.create_expense_claims(xero_tenant_id, expenseClaims)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createExpenseClaims: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let expenseClaims = { "ExpenseClaims": [ { "Status": "SUBMITTED", "User": { "UserID": "d1164823-0ac1-41ad-987b-b4e30fe0b273" }, "Receipts": [ { "Lineitems": [], "ReceiptID": "dc1c7f6d-0a4c-402f-acac-551d62ce5816" } ] } ] }; // ExpenseClaims

    let mut context = AccountingApi::Context::default();
    let result = client.createExpenseClaims(xeroTenantId, expenseClaims, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
expenseClaims *
ExpenseClaims
ExpenseClaims with array of ExpenseClaim object in body of request
Required

createInvoiceAttachmentByFileName

Creates an attachment for a specific invoice or purchase bill by filename


/Invoices/{InvoiceID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}/Attachments/{FileName}?IncludeOnline=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID invoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        Boolean includeOnline = true;
        
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.createInvoiceAttachmentByFileName(accessToken, xeroTenantId, invoiceID, fileName, body, includeOnline, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createInvoiceAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID invoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Invoice
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        Boolean includeOnline = true; // Boolean | Allows an attachment to be seen by the end customer within their online invoice
        try {
            Attachments result = apiInstance.createInvoiceAttachmentByFileName(xeroTenantId, invoiceID, fileName, body, includeOnline);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createInvoiceAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *invoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Invoice (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 
Boolean *includeOnline = true; // Allows an attachment to be seen by the end customer within their online invoice (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates an attachment for a specific invoice or purchase bill by filename
[apiInstance createInvoiceAttachmentByFileNameWith:xeroTenantId
    invoiceID:invoiceID
    fileName:fileName
    body:body
    includeOnline:includeOnline
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const invoiceID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const includeOnline = true;
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createInvoiceAttachmentByFileName(xeroTenantId, invoiceID, fileName, body,  includeOnline, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateInvoiceAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var invoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            var includeOnline = true;
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.CreateInvoiceAttachmentByFileNameAsync(accessToken, xeroTenantId, invoiceID, fileName, body, includeOnline);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateInvoiceAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$invoiceID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$includeOnline = true;

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->createInvoiceAttachmentByFileName($xeroTenantId, $invoiceID, $fileName, $body, $includeOnline);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createInvoiceAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Invoice
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 
my $includeOnline = true; # Boolean | Allows an attachment to be seen by the end customer within their online invoice

eval { 
    my $result = $api_instance->createInvoiceAttachmentByFileName(xeroTenantId => $xeroTenantId, invoiceID => $invoiceID, fileName => $fileName, body => $body, includeOnline => $includeOnline);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createInvoiceAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_invoice_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    invoice_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    include_online = 'true'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.create_invoice_attachment_by_file_name(xero_tenant_id, invoice_id, file_name, body, include_online)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createInvoiceAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]
    let includeOnline = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.createInvoiceAttachmentByFileName(xeroTenantId, invoiceID, fileName, body, includeOnline, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
InvoiceID*
UUID (uuid)
Unique identifier for an Invoice
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required
Query parameters
Name Description
IncludeOnline
Boolean
Allows an attachment to be seen by the end customer within their online invoice

createInvoiceHistory

Creates a history record for a specific invoice


/Invoices/{InvoiceID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID invoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createInvoiceHistory(accessToken, xeroTenantId, invoiceID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createInvoiceHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID invoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Invoice
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createInvoiceHistory(xeroTenantId, invoiceID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createInvoiceHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *invoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Invoice (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific invoice
[apiInstance createInvoiceHistoryWith:xeroTenantId
    invoiceID:invoiceID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const invoiceID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
    details: "Hello World" }; 

const historyRecords: HistoryRecords = {  
    historyRecords: [historyRecord] }; 

try {
  const response = await xero.accountingApi.createInvoiceHistory(xeroTenantId, invoiceID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateInvoiceHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var invoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateInvoiceHistoryAsync(accessToken, xeroTenantId, invoiceID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateInvoiceHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$invoiceID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createInvoiceHistory($xeroTenantId, $invoiceID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createInvoiceHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Invoice
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createInvoiceHistory(xeroTenantId => $xeroTenantId, invoiceID => $invoiceID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createInvoiceHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_invoice_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    invoice_id = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    historyRecords = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_invoice_history(xero_tenant_id, invoice_id, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createInvoiceHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createInvoiceHistory(xeroTenantId, invoiceID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
InvoiceID*
UUID (uuid)
Unique identifier for an Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createInvoices

Creates one or more sales invoices or purchase bills


/Invoices

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices?summarizeErrors=true&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        Boolean summarizeErrors = true;
        Integer unitdp = 4;
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);
        LocalDate dueDateValue = LocalDate.of(2020, Month.OCTOBER, 28);
        
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        LineItemTracking lineItemTracking = new LineItemTracking();
        lineItemTracking.setTrackingCategoryID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        lineItemTracking.setTrackingOptionID(UUID.fromString("00000000-0000-0000-0000-000000000000"));

        List<LineItemTracking> lineItemTrackings = new ArrayList<LineItemTracking>();
        lineItemTrackings.add(lineItemTracking);
        
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");
        lineItem.setTracking(lineItemTrackings);

        List<LineItem> lineItems = new ArrayList<LineItem>();
        lineItems.add(lineItem);
        
        Invoice invoice = new Invoice();
        invoice.setType(com.xero.models.accounting.Invoice.TypeEnum.ACCREC);
        invoice.setContact(contact);
        invoice.setDate(dateValue);
        invoice.setDueDate(dueDateValue);
        invoice.setLineItems(lineItems);
        invoice.setReference("Website Design");
        invoice.setStatus(com.xero.models.accounting.Invoice.StatusEnum.DRAFT);
        
        Invoices invoices = new Invoices();
        invoices.addInvoicesItem(invoice);

        try {
            Invoices result = apiInstance.createInvoices(accessToken, xeroTenantId, invoices, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createInvoices");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Invoices invoices = { "Invoices": [ { "Type": "ACCREC", "Contact": { "ContactID": "430fa14a-f945-44d3-9f97-5df5e28441b8" }, "LineItems": [ { "Description": "Acme Tires", "Quantity": 2, "UnitAmount": 20, "AccountCode": "200", "TaxType": "NONE", "LineAmount": 40 } ], "Date": "2019-03-11", "DueDate": "2018-12-10", "Reference": "Website Design", "Status": "AUTHORISED" } ] }; // Invoices | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Invoices result = apiInstance.createInvoices(xeroTenantId, invoices, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createInvoices");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Invoices *invoices = { "Invoices": [ { "Type": "ACCREC", "Contact": { "ContactID": "430fa14a-f945-44d3-9f97-5df5e28441b8" }, "LineItems": [ { "Description": "Acme Tires", "Quantity": 2, "UnitAmount": 20, "AccountCode": "200", "TaxType": "NONE", "LineAmount": 40 } ], "Date": "2019-03-11", "DueDate": "2018-12-10", "Reference": "Website Design", "Status": "AUTHORISED" } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates one or more sales invoices or purchase bills
[apiInstance createInvoicesWith:xeroTenantId
    invoices:invoices
    summarizeErrors:summarizeErrors
    unitdp:unitdp
              completionHandler: ^(Invoices output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;
const unitdp = 4;
const dateValue = '2020-10-10'
const dueDateValue = '2020-10-28'

const contact: Contact = { 
    contactID: "00000000-0000-0000-0000-000000000000" }; 

const lineItemTracking: LineItemTracking = { 
    trackingCategoryID: "00000000-0000-0000-0000-000000000000",
    trackingOptionID: "00000000-0000-0000-0000-000000000000" };   
const lineItemTrackings = [];    
lineItemTrackings.push(lineItemTracking)

const lineItem: LineItem = { 
    description: "Foobar",
    quantity: 1.0,
    unitAmount: 20.0,
    accountCode: "000",
    tracking: lineItemTrackings };   
const lineItems = [];    
lineItems.push(lineItem)

const invoice: Invoice = { 
    type: Invoice.TypeEnum.ACCREC,
    contact: contact,
    date: dateValue,
    dueDate: dueDateValue,
    lineItems: lineItems,
    reference: "Website Design",
    status: Invoice.StatusEnum.DRAFT }; 

const invoices: Invoices = {  
    invoices: [invoice] }; 

try {
  const response = await xero.accountingApi.createInvoices(xeroTenantId, invoices,  summarizeErrors, unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateInvoicesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;
            var unitdp = 4;
            var dateValue = new DateTime(2020, 10, 10);
            var dueDateValue = new DateTime(2020, 10, 10);

            var contact = new Contact();
            contact.ContactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var lineItemTracking = new LineItemTracking();
            lineItemTracking.TrackingCategoryID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            lineItemTracking.TrackingOptionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var lineItemTrackings = new List<LineItemTracking>();
            lineItemTrackings.Add(lineItemTracking);

            var lineItem = new LineItem();
            lineItem.Description = "Foobar";
            lineItem.Quantity = new decimal(1.0);
            lineItem.UnitAmount = new decimal(20.0);
            lineItem.AccountCode = "000";
            lineItem.Tracking = lineItemTrackings;
            var lineItems = new List<LineItem>();
            lineItems.Add(lineItem);

            var invoice = new Invoice();
            invoice.Type = Invoice.TypeEnum.ACCREC;
            invoice.Contact = contact;
            invoice.Date = dateValue;
            invoice.DueDate = dueDateValue;
            invoice.LineItems = lineItems;
            invoice.Reference = "Website Design";
            invoice.Status = Invoice.StatusEnum.DRAFT;

            var invoices = new Invoices();
            var invoicesList = new List<Invoice>();
            invoicesList.Add(invoice); 
            invoices._Invoices = invoicesList;
            
            try {
                var result = await apiInstance.CreateInvoicesAsync(accessToken, xeroTenantId, invoices, summarizeErrors, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateInvoices: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$unitdp = 4;
$dateValue = new DateTime('2020-10-10');
$dueDateValue = new DateTime('2020-10-28');

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$lineItemTracking = new XeroAPI\XeroPHP\Models\Accounting\LineItemTracking;
$lineItemTracking->setTrackingCategoryID('00000000-0000-0000-0000-000000000000');
$lineItemTracking->setTrackingOptionID('00000000-0000-0000-0000-000000000000');
$lineItemTrackings = [];
array_push($lineItemTrackings, $lineItemTracking);

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItem->setTracking(lineItemTrackings);
$lineItems = [];
array_push($lineItems, $lineItem);

$invoice = new XeroAPI\XeroPHP\Models\Accounting\Invoice;
$invoice->setType(XeroAPI\XeroPHP\Models\Accounting\Invoice::TYPE_ACCREC);
$invoice->setContact($contact);
$invoice->setDate($dateValue);
$invoice->setDueDate($dueDateValue);
$invoice->setLineItems($lineItems);
$invoice->setReference('Website Design');
$invoice->setStatus(XeroAPI\XeroPHP\Models\Accounting\Invoice::STATUS_DRAFT);

$invoices = new XeroAPI\XeroPHP\Models\Accounting\Invoices;
$arr_invoices = [];
array_push($arr_invoices, $invoice);
$invoices->setInvoices($arr_invoices);

try {
  $result = $apiInstance->createInvoices($xeroTenantId, $invoices, $summarizeErrors, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createInvoices: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoices = ::Object::Invoices->new(); # Invoices | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->createInvoices(xeroTenantId => $xeroTenantId, invoices => $invoices, summarizeErrors => $summarizeErrors, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createInvoices: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_invoices():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'
    date_value = dateutil.parser.parse('2020-10-10T00:00:00Z')
    due_date_value = dateutil.parser.parse('2020-10-28T00:00:00Z')

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    line_item_tracking = LineItemTracking(
        tracking_category_id = "00000000-0000-0000-0000-000000000000",
        tracking_option_id = "00000000-0000-0000-0000-000000000000")
    
    line_item_trackings = []    
    line_item_trackings.append(line_item_tracking)

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000",
        tracking = lineItemTrackings)
    
    line_items = []    
    line_items.append(line_item)

    invoice = Invoice(
        type = "ACCREC",
        contact = contact,
        date = date_value,
        due_date = due_date_value,
        line_items = line_items,
        reference = "Website Design",
        status = "DRAFT")

    invoices = Invoices( 
        invoices = [invoice])
    
    try:
        api_response = api_instance.create_invoices(xero_tenant_id, invoices, summarize_errors, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createInvoices: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoices = { "Invoices": [ { "Type": "ACCREC", "Contact": { "ContactID": "430fa14a-f945-44d3-9f97-5df5e28441b8" }, "LineItems": [ { "Description": "Acme Tires", "Quantity": 2, "UnitAmount": 20, "AccountCode": "200", "TaxType": "NONE", "LineAmount": 40 } ], "Date": "2019-03-11", "DueDate": "2018-12-10", "Reference": "Website Design", "Status": "AUTHORISED" } ] }; // Invoices
    let summarizeErrors = true; // Boolean
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.createInvoices(xeroTenantId, invoices, summarizeErrors, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
invoices *
Invoices
Invoices with an array of invoice objects in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

createItemHistory

Creates a history record for a specific item


/Items/{ItemID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Items/{ItemID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID itemID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createItemHistory(accessToken, xeroTenantId, itemID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createItemHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID itemID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Item
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createItemHistory(xeroTenantId, itemID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createItemHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *itemID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Item (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific item
[apiInstance createItemHistoryWith:xeroTenantId
    itemID:itemID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const itemID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
    details: "Hello World" }; 

const historyRecords: HistoryRecords = {  
    historyRecords: [historyRecord] }; 

try {
  const response = await xero.accountingApi.createItemHistory(xeroTenantId, itemID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateItemHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var itemID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateItemHistoryAsync(accessToken, xeroTenantId, itemID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateItemHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$itemID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createItemHistory($xeroTenantId, $itemID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createItemHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $itemID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Item
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createItemHistory(xeroTenantId => $xeroTenantId, itemID => $itemID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createItemHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_item_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    item_id = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    historyRecords = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_item_history(xero_tenant_id, item_id, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createItemHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let itemID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createItemHistory(xeroTenantId, itemID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Path parameters
Name Description
ItemID*
UUID (uuid)
Unique identifier for an Item
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createItems

Creates one or more items


/Items

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Items?summarizeErrors=true&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        Boolean summarizeErrors = true;
        Integer unitdp = 4;
        
        Purchase purchaseDetails = new Purchase();
        purchaseDetails.setCoGSAccountCode("500");
        
        Item item = new Item();
        item.setCode("abcXYZ123");
        item.setName("HelloWorld");
        item.setDescription("Foobar");
        item.setInventoryAssetAccountCode("140");
        item.setPurchaseDetails(purchaseDetails);
        
        Items items = new Items();
        items.addItemsItem(item);

        try {
            Items result = apiInstance.createItems(accessToken, xeroTenantId, items, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createItems");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Items items = { "Items": [ { "Code": "code123", "Name": "Item Name XYZ", "Description": "Foobar", "InventoryAssetAccountCode": "140", "PurchaseDetails": { "COGSAccountCode": "500" } } ] }; // Items | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Items result = apiInstance.createItems(xeroTenantId, items, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createItems");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Items *items = { "Items": [ { "Code": "code123", "Name": "Item Name XYZ", "Description": "Foobar", "InventoryAssetAccountCode": "140", "PurchaseDetails": { "COGSAccountCode": "500" } } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates one or more items
[apiInstance createItemsWith:xeroTenantId
    items:items
    summarizeErrors:summarizeErrors
    unitdp:unitdp
              completionHandler: ^(Items output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;
const unitdp = 4;

const purchaseDetails: Purchase = { 
    cOGSAccountCode: "500" }; 

const item: Item = { 
    code: "abcXYZ123",
    name: "HelloWorld",
    description: "Foobar",
    inventoryAssetAccountCode: "140",
    purchaseDetails: purchaseDetails }; 

const items: Items = {  
    items: [item] }; 

try {
  const response = await xero.accountingApi.createItems(xeroTenantId, items,  summarizeErrors, unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateItemsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;
            var unitdp = 4;

            var purchaseDetails = new Purchase();
            purchaseDetails.COGSAccountCode = "500";

            var item = new Item();
            item.Code = "abcXYZ123";
            item.Name = "HelloWorld";
            item.Description = "Foobar";
            item.InventoryAssetAccountCode = "140";
            item.PurchaseDetails = purchaseDetails;

            var items = new Items();
            var itemsList = new List<Item>();
            itemsList.Add(item); 
            items._Items = itemsList;
            
            try {
                var result = await apiInstance.CreateItemsAsync(accessToken, xeroTenantId, items, summarizeErrors, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateItems: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$unitdp = 4;

$purchaseDetails = new XeroAPI\XeroPHP\Models\Accounting\Purchase;
$purchaseDetails->setCoGSAccountCode('500');

$item = new XeroAPI\XeroPHP\Models\Accounting\Item;
$item->setCode('abcXYZ123');
$item->setName('HelloWorld');
$item->setDescription('Foobar');
$item->setInventoryAssetAccountCode('140');
$item->setPurchaseDetails($purchaseDetails);

$items = new XeroAPI\XeroPHP\Models\Accounting\Items;
$arr_items = [];
array_push($arr_items, $item);
$items->setItems($arr_items);

try {
  $result = $apiInstance->createItems($xeroTenantId, $items, $summarizeErrors, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createItems: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $items = ::Object::Items->new(); # Items | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->createItems(xeroTenantId => $xeroTenantId, items => $items, summarizeErrors => $summarizeErrors, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createItems: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_items():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'

    purchase_details = Purchase(
        cogs_account_code = "500")

    item = Item(
        code = "abcXYZ123",
        name = "HelloWorld",
        description = "Foobar",
        inventory_asset_account_code = "140",
        purchase_details = purchase_details)

    items = Items( 
        items = [item])
    
    try:
        api_response = api_instance.create_items(xero_tenant_id, items, summarize_errors, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createItems: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let items = { "Items": [ { "Code": "code123", "Name": "Item Name XYZ", "Description": "Foobar", "InventoryAssetAccountCode": "140", "PurchaseDetails": { "COGSAccountCode": "500" } } ] }; // Items
    let summarizeErrors = true; // Boolean
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.createItems(xeroTenantId, items, summarizeErrors, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
items *
Items
Items with an array of Item objects in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

createLinkedTransaction

Creates linked transactions (billable expenses)


/LinkedTransactions

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/LinkedTransactions"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        
        LinkedTransaction linkedTransaction = new LinkedTransaction();
        linkedTransaction.setSourceTransactionID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        linkedTransaction.setSourceLineItemID(UUID.fromString("00000000-0000-0000-0000-000000000000"));

        try {
            LinkedTransactions result = apiInstance.createLinkedTransaction(accessToken, xeroTenantId, linkedTransaction);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createLinkedTransaction");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        LinkedTransaction linkedTransaction = { "LinkedTransactions": [ { "SourceTransactionID": "a848644a-f20f-4630-98c3-386bd7505631", "SourceLineItemID": "b0df260d-3cc8-4ced-9bd6-41924f624ed3" } ] }; // LinkedTransaction | 
        try {
            LinkedTransactions result = apiInstance.createLinkedTransaction(xeroTenantId, linkedTransaction);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createLinkedTransaction");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
LinkedTransaction *linkedTransaction = { "LinkedTransactions": [ { "SourceTransactionID": "a848644a-f20f-4630-98c3-386bd7505631", "SourceLineItemID": "b0df260d-3cc8-4ced-9bd6-41924f624ed3" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates linked transactions (billable expenses)
[apiInstance createLinkedTransactionWith:xeroTenantId
    linkedTransaction:linkedTransaction
              completionHandler: ^(LinkedTransactions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';

const linkedTransaction: LinkedTransaction = { 
    sourceTransactionID: "00000000-0000-0000-0000-000000000000",
    sourceLineItemID: "00000000-0000-0000-0000-000000000000" }; 

try {
  const response = await xero.accountingApi.createLinkedTransaction(xeroTenantId, linkedTransaction);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateLinkedTransactionExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";

            var linkedTransaction = new LinkedTransaction();
            linkedTransaction.SourceTransactionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            linkedTransaction.SourceLineItemID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.CreateLinkedTransactionAsync(accessToken, xeroTenantId, linkedTransaction);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateLinkedTransaction: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

$linkedTransaction = new XeroAPI\XeroPHP\Models\Accounting\LinkedTransaction;
$linkedTransaction->setSourceTransactionID('00000000-0000-0000-0000-000000000000');
$linkedTransaction->setSourceLineItemID('00000000-0000-0000-0000-000000000000');

try {
  $result = $apiInstance->createLinkedTransaction($xeroTenantId, $linkedTransaction);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createLinkedTransaction: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $linkedTransaction = ::Object::LinkedTransaction->new(); # LinkedTransaction | 

eval { 
    my $result = $api_instance->createLinkedTransaction(xeroTenantId => $xeroTenantId, linkedTransaction => $linkedTransaction);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createLinkedTransaction: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_linked_transaction():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'

    linked_transaction = LinkedTransaction(
        source_transaction_id = "00000000-0000-0000-0000-000000000000",
        source_line_item_id = "00000000-0000-0000-0000-000000000000")
    
    try:
        api_response = api_instance.create_linked_transaction(xero_tenant_id, linkedTransaction)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createLinkedTransaction: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let linkedTransaction = { "LinkedTransactions": [ { "SourceTransactionID": "a848644a-f20f-4630-98c3-386bd7505631", "SourceLineItemID": "b0df260d-3cc8-4ced-9bd6-41924f624ed3" } ] }; // LinkedTransaction

    let mut context = AccountingApi::Context::default();
    let result = client.createLinkedTransaction(xeroTenantId, linkedTransaction, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
linkedTransaction *
LinkedTransaction
LinkedTransaction object in body of request
Required

createManualJournalAttachmentByFileName

Creates a specific attachment for a specific manual journal by file name


/ManualJournals/{ManualJournalID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ManualJournals/{ManualJournalID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID manualJournalID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.createManualJournalAttachmentByFileName(accessToken, xeroTenantId, manualJournalID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createManualJournalAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a ManualJournal
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.createManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createManualJournalAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *manualJournalID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a ManualJournal (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a specific attachment for a specific manual journal by file name
[apiInstance createManualJournalAttachmentByFileNameWith:xeroTenantId
    manualJournalID:manualJournalID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const manualJournalID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateManualJournalAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var manualJournalID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.CreateManualJournalAttachmentByFileNameAsync(accessToken, xeroTenantId, manualJournalID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateManualJournalAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$manualJournalID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->createManualJournalAttachmentByFileName($xeroTenantId, $manualJournalID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createManualJournalAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $manualJournalID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a ManualJournal
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->createManualJournalAttachmentByFileName(xeroTenantId => $xeroTenantId, manualJournalID => $manualJournalID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createManualJournalAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_manual_journal_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    manual_journal_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.create_manual_journal_attachment_by_file_name(xero_tenant_id, manual_journal_id, file_name, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createManualJournalAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.createManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
ManualJournalID*
UUID (uuid)
Unique identifier for a ManualJournal
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

createManualJournalHistoryRecord

Creates a history record for a specific manual journal


/ManualJournals/{ManualJournalID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ManualJournals/{ManualJournalID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID manualJournalID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createManualJournalHistoryRecord(accessToken, xeroTenantId, manualJournalID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createManualJournalHistoryRecord");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a ManualJournal
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createManualJournalHistoryRecord(xeroTenantId, manualJournalID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createManualJournalHistoryRecord");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *manualJournalID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a ManualJournal (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific manual journal
[apiInstance createManualJournalHistoryRecordWith:xeroTenantId
    manualJournalID:manualJournalID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const manualJournalID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
    details: "Hello World" }; 

const historyRecords: HistoryRecords = {  
    historyRecords: [historyRecord] }; 

try {
  const response = await xero.accountingApi.createManualJournalHistoryRecord(xeroTenantId, manualJournalID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateManualJournalHistoryRecordExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var manualJournalID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateManualJournalHistoryRecordAsync(accessToken, xeroTenantId, manualJournalID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateManualJournalHistoryRecord: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$manualJournalID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createManualJournalHistoryRecord($xeroTenantId, $manualJournalID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createManualJournalHistoryRecord: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $manualJournalID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a ManualJournal
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createManualJournalHistoryRecord(xeroTenantId => $xeroTenantId, manualJournalID => $manualJournalID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createManualJournalHistoryRecord: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_manual_journal_history_record():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    manual_journal_id = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    historyRecords = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_manual_journal_history_record(xero_tenant_id, manual_journal_id, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createManualJournalHistoryRecord: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createManualJournalHistoryRecord(xeroTenantId, manualJournalID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
ManualJournalID*
UUID (uuid)
Unique identifier for a ManualJournal
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createManualJournals

Creates one or more manual journals


/ManualJournals

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ManualJournals?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        Boolean summarizeErrors = true;
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);

        List<ManualJournalLine> manualJournalLines = new ArrayList<ManualJournalLine>();
        
        ManualJournalLine credit = new ManualJournalLine();
        credit.setLineAmount(100.0);
        credit.setAccountCode("400");
        credit.setDescription("Hello there");
        manualJournalLines.add(credit);
        
        ManualJournalLine debit = new ManualJournalLine();
        debit.setLineAmount(-100.0);
        debit.setAccountCode("120");
        debit.setDescription("Hello there");
        manualJournalLines.add(debit);
        
        ManualJournal manualJournal = new ManualJournal();
        manualJournal.setNarration("Foobar");
        manualJournal.setDate(dateValue);
        manualJournal.setJournalLines(manualJournalLines);
        
        ManualJournals manualJournals = new ManualJournals();
        manualJournals.addManualJournalsItem(manualJournal);

        try {
            ManualJournals result = apiInstance.createManualJournals(accessToken, xeroTenantId, manualJournals, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createManualJournals");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        ManualJournals manualJournals = { "ManualJournals": [ { "Narration": "Journal Desc", "JournalLines": [ { "LineAmount": 100, "AccountCode": "400", "Description": "Money Movement" }, { "LineAmount": -100, "AccountCode": "400", "Description": "Prepayment of things", "Tracking": [ { "Name": "North", "Option": "Region" } ] } ], "Date": "2019-03-14" } ] }; // ManualJournals | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            ManualJournals result = apiInstance.createManualJournals(xeroTenantId, manualJournals, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createManualJournals");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
ManualJournals *manualJournals = { "ManualJournals": [ { "Narration": "Journal Desc", "JournalLines": [ { "LineAmount": 100, "AccountCode": "400", "Description": "Money Movement" }, { "LineAmount": -100, "AccountCode": "400", "Description": "Prepayment of things", "Tracking": [ { "Name": "North", "Option": "Region" } ] } ], "Date": "2019-03-14" } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates one or more manual journals
[apiInstance createManualJournalsWith:xeroTenantId
    manualJournals:manualJournals
    summarizeErrors:summarizeErrors
              completionHandler: ^(ManualJournals output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;
const dateValue = '2020-10-10'  
const manualJournalLines = [];

const credit: ManualJournalLine = { 
    lineAmount: 100.0,
    accountCode: "400",
    description: "Hello there" };     
manualJournalLines.push(credit)

const debit: ManualJournalLine = { 
    lineAmount: -100.0,
    accountCode: "120",
    description: "Hello there" };     
manualJournalLines.push(debit)

const manualJournal: ManualJournal = { 
    narration: "Foobar",
    date: dateValue,
    journalLines: manualJournalLines }; 

const manualJournals: ManualJournals = {  
    manualJournals: [manualJournal] }; 

try {
  const response = await xero.accountingApi.createManualJournals(xeroTenantId, manualJournals,  summarizeErrors);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateManualJournalsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;
            var dateValue = new DateTime(2020, 10, 10);
            var manualJournalLines = new List<ManualJournalLine>();

            var credit = new ManualJournalLine();
            credit.LineAmount = new decimal(100.0);
            credit.AccountCode = "400";
            credit.Description = "Hello there";
            manualJournalLines.Add(credit);

            var debit = new ManualJournalLine();
            debit.LineAmount = new decimal(-100.0);
            debit.AccountCode = "120";
            debit.Description = "Hello there";
            manualJournalLines.Add(debit);

            var manualJournal = new ManualJournal();
            manualJournal.Narration = "Foobar";
            manualJournal.Date = dateValue;
            manualJournal.JournalLines = manualJournalLines;

            var manualJournals = new ManualJournals();
            var manualJournalsList = new List<ManualJournal>();
            manualJournalsList.Add(manualJournal); 
            manualJournals._ManualJournals = manualJournalsList;
            
            try {
                var result = await apiInstance.CreateManualJournalsAsync(accessToken, xeroTenantId, manualJournals, summarizeErrors);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateManualJournals: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$dateValue = new DateTime('2019-10-10');
$manualJournalLines = [];

$credit = new XeroAPI\XeroPHP\Models\Accounting\ManualJournalLine;
$credit->setLineAmount(100.0);
$credit->setAccountCode('400');
$credit->setDescription('Hello there');
array_push($manualJournalLines, $credit);

$debit = new XeroAPI\XeroPHP\Models\Accounting\ManualJournalLine;
$debit->setLineAmount(-100.0);
$debit->setAccountCode('120');
$debit->setDescription('Hello there');
array_push($manualJournalLines, $debit);

$manualJournal = new XeroAPI\XeroPHP\Models\Accounting\ManualJournal;
$manualJournal->setNarration('Foobar');
$manualJournal->setDate($dateValue);
$manualJournal->setJournalLines($manualJournalLines);

$manualJournals = new XeroAPI\XeroPHP\Models\Accounting\ManualJournals;
$arr_manual_journals = [];
array_push($arr_manual_journals, $manualJournal);
$manualJournals->setManualJournals($arr_manual_journals);

try {
  $result = $apiInstance->createManualJournals($xeroTenantId, $manualJournals, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createManualJournals: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $manualJournals = ::Object::ManualJournals->new(); # ManualJournals | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->createManualJournals(xeroTenantId => $xeroTenantId, manualJournals => $manualJournals, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createManualJournals: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_manual_journals():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'
    date_value = dateutil.parser.parse('2020-12-03T00:00:00Z')
    
    manual_journal_lines = []

    credit = ManualJournalLine(
        line_amount = 100.0,
        account_code = "400",
        description = "Hello there")    
    manual_journal_lines.append(credit)

    debit = ManualJournalLine(
        line_amount = -100.0,
        account_code = "120",
        description = "Hello there")    
    manual_journal_lines.append(debit)

    manual_journal = ManualJournal(
        narration = "Foobar",
        date = date_value,
        journal_lines = manual_journal_lines)

    manualJournals = ManualJournals( 
        manual_journals = [manual_journal])
    
    try:
        api_response = api_instance.create_manual_journals(xero_tenant_id, manualJournals, summarize_errors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createManualJournals: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let manualJournals = { "ManualJournals": [ { "Narration": "Journal Desc", "JournalLines": [ { "LineAmount": 100, "AccountCode": "400", "Description": "Money Movement" }, { "LineAmount": -100, "AccountCode": "400", "Description": "Prepayment of things", "Tracking": [ { "Name": "North", "Option": "Region" } ] } ], "Date": "2019-03-14" } ] }; // ManualJournals
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.createManualJournals(xeroTenantId, manualJournals, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
manualJournals *
ManualJournals
ManualJournals array with ManualJournal object in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

createOverpaymentAllocations

Creates a single allocation for a specific overpayment


/Overpayments/{OverpaymentID}/Allocations

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Overpayments/{OverpaymentID}/Allocations?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID overpaymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Boolean summarizeErrors = true;
        LocalDate currDate = LocalDate.now();
        
        Invoice invoice = new Invoice();
        invoice.setInvoiceID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        Allocation allocation = new Allocation();
        allocation.setAmount(1.0);
        allocation.setDate(currDate);
        allocation.setInvoice(invoice);
        
        Allocations allocations = new Allocations();
        allocations.addAllocationsItem(allocation);

        try {
            Allocations result = apiInstance.createOverpaymentAllocations(accessToken, xeroTenantId, overpaymentID, allocations, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createOverpaymentAllocations");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID overpaymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Overpayment
        Allocations allocations = { "Allocations": [ { "Invoice": { "InvoiceID": "00000000-0000-0000-0000-000000000000", "LineItems": [], "Contact": {}, "Type": "ACCPAY" }, "Amount": 10.00, "Date": "2019-03-12" } ] }; // Allocations | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            Allocations result = apiInstance.createOverpaymentAllocations(xeroTenantId, overpaymentID, allocations, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createOverpaymentAllocations");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *overpaymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Overpayment (default to null)
Allocations *allocations = { "Allocations": [ { "Invoice": { "InvoiceID": "00000000-0000-0000-0000-000000000000", "LineItems": [], "Contact": {}, "Type": "ACCPAY" }, "Amount": 10.00, "Date": "2019-03-12" } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a single allocation for a specific overpayment
[apiInstance createOverpaymentAllocationsWith:xeroTenantId
    overpaymentID:overpaymentID
    allocations:allocations
    summarizeErrors:summarizeErrors
              completionHandler: ^(Allocations output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const overpaymentID = '00000000-0000-0000-0000-000000000000';
const summarizeErrors = true;
const currDate = '2020-12-10'

const invoice: Invoice = { 
    invoiceID: "00000000-0000-0000-0000-000000000000" }; 

const allocation: Allocation = { 
    amount: 1.0,
    date: currDate,
    invoice: invoice }; 

const allocations: Allocations = {  
    allocations: [allocation] }; 

try {
  const response = await xero.accountingApi.createOverpaymentAllocations(xeroTenantId, overpaymentID, allocations,  summarizeErrors);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateOverpaymentAllocationsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var overpaymentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var summarizeErrors = true;
            var currDate = DateTime.Now;

            var invoice = new Invoice();
            invoice.InvoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var allocation = new Allocation();
            allocation.Amount = new decimal(1.0);
            allocation.Date = currDate;
            allocation.Invoice = invoice;

            var allocations = new Allocations();
            var allocationsList = new List<Allocation>();
            allocationsList.Add(allocation); 
            allocations._Allocations = allocationsList;
            
            try {
                var result = await apiInstance.CreateOverpaymentAllocationsAsync(accessToken, xeroTenantId, overpaymentID, allocations, summarizeErrors);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateOverpaymentAllocations: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$overpaymentID = "00000000-0000-0000-0000-000000000000";
$summarizeErrors = true;
$currDate = new DateTime('2020-12-10');

$invoice = new XeroAPI\XeroPHP\Models\Accounting\Invoice;
$invoice->setInvoiceID('00000000-0000-0000-0000-000000000000');

$allocation = new XeroAPI\XeroPHP\Models\Accounting\Allocation;
$allocation->setAmount(1.0);
$allocation->setDate($currDate);
$allocation->setInvoice($invoice);

$allocations = new XeroAPI\XeroPHP\Models\Accounting\Allocations;
$arr_allocations = [];
array_push($arr_allocations, $allocation);
$allocations->setAllocations($arr_allocations);

try {
  $result = $apiInstance->createOverpaymentAllocations($xeroTenantId, $overpaymentID, $allocations, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createOverpaymentAllocations: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $overpaymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Overpayment
my $allocations = ::Object::Allocations->new(); # Allocations | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->createOverpaymentAllocations(xeroTenantId => $xeroTenantId, overpaymentID => $overpaymentID, allocations => $allocations, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createOverpaymentAllocations: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_overpayment_allocations():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    overpayment_id = '00000000-0000-0000-0000-000000000000'
    summarize_errors = 'True'
    curr_date = dateutil.parser.parse('2020-12-03T00:00:00Z')

    invoice = Invoice(
        invoice_id = "00000000-0000-0000-0000-000000000000")

    allocation = Allocation(
        amount = 1.0,
        date = curr_date,
        invoice = invoice)

    allocations = Allocations( 
        allocations = [allocation])
    
    try:
        api_response = api_instance.create_overpayment_allocations(xero_tenant_id, overpayment_id, allocations, summarize_errors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createOverpaymentAllocations: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let overpaymentID = 00000000-0000-0000-0000-000000000000; // UUID
    let allocations = { "Allocations": [ { "Invoice": { "InvoiceID": "00000000-0000-0000-0000-000000000000", "LineItems": [], "Contact": {}, "Type": "ACCPAY" }, "Amount": 10.00, "Date": "2019-03-12" } ] }; // Allocations
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.createOverpaymentAllocations(xeroTenantId, overpaymentID, allocations, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
OverpaymentID*
UUID (uuid)
Unique identifier for a Overpayment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
allocations *
Allocations
Allocations array with Allocation object in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

createOverpaymentHistory

Creates a history record for a specific overpayment


/Overpayments/{OverpaymentID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Overpayments/{OverpaymentID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID overpaymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createOverpaymentHistory(accessToken, xeroTenantId, overpaymentID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createOverpaymentHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID overpaymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Overpayment
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createOverpaymentHistory(xeroTenantId, overpaymentID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createOverpaymentHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *overpaymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Overpayment (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific overpayment
[apiInstance createOverpaymentHistoryWith:xeroTenantId
    overpaymentID:overpaymentID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const overpaymentID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
    details: "Hello World" }; 

const historyRecords: HistoryRecords = {  
    historyRecords: [historyRecord] }; 

try {
  const response = await xero.accountingApi.createOverpaymentHistory(xeroTenantId, overpaymentID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateOverpaymentHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var overpaymentID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateOverpaymentHistoryAsync(accessToken, xeroTenantId, overpaymentID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateOverpaymentHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$overpaymentID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createOverpaymentHistory($xeroTenantId, $overpaymentID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createOverpaymentHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $overpaymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Overpayment
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createOverpaymentHistory(xeroTenantId => $xeroTenantId, overpaymentID => $overpaymentID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createOverpaymentHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_overpayment_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    overpayment_id = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    historyRecords = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_overpayment_history(xero_tenant_id, overpayment_id, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createOverpaymentHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let overpaymentID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createOverpaymentHistory(xeroTenantId, overpaymentID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
OverpaymentID*
UUID (uuid)
Unique identifier for a Overpayment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createPayment

Creates a single payment for invoice or credit notes


/Payments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Payments"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);
        
        Invoice invoice = new Invoice();
        invoice.setInvoiceID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        Account account = new Account();
        account.setAccountID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        Payment payment = new Payment();
        payment.setInvoice(invoice);
        payment.setAccount(account);
        payment.setAmount(1.0);
        payment.setDate(dateValue);
        
        Payments payments = new Payments();
        payments.addPaymentsItem(payment);

        try {
            Payments result = apiInstance.createPayment(accessToken, xeroTenantId, payment);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createPayment");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Payment payment = { "Payments": [ { "Invoice": { "LineItems": [], "InvoiceID": "00000000-0000-0000-0000-000000000000" }, "Account": { "Code": "970" }, "Date": "2019-03-12", "Amount": 1 } ] }; // Payment | 
        try {
            Payments result = apiInstance.createPayment(xeroTenantId, payment);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createPayment");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Payment *payment = { "Payments": [ { "Invoice": { "LineItems": [], "InvoiceID": "00000000-0000-0000-0000-000000000000" }, "Account": { "Code": "970" }, "Date": "2019-03-12", "Amount": 1 } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a single payment for invoice or credit notes
[apiInstance createPaymentWith:xeroTenantId
    payment:payment
              completionHandler: ^(Payments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const dateValue = '2020-10-10'

const invoice: Invoice = { 
    invoiceID: "00000000-0000-0000-0000-000000000000" }; 

const account: Account = { 
    accountID: "00000000-0000-0000-0000-000000000000" }; 

const payment: Payment = { 
    invoice: invoice,
    account: account,
    amount: 1.0,
    date: dateValue }; 

const payments: Payments = {  
    payments: [payment] }; 

try {
  const response = await xero.accountingApi.createPayment(xeroTenantId, payment);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreatePaymentExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var dateValue = DateTime.Now;

            var invoice = new Invoice();
            invoice.InvoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var account = new Account();
            account.AccountID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var payment = new Payment();
            payment.Invoice = invoice;
            payment.Account = account;
            payment.Amount = new decimal(1.0);
            payment.Date = dateValue;

            var payments = new Payments();
            var paymentsList = new List<Payment>();
            paymentsList.Add(payment); 
            payments._Payments = paymentsList;
            
            try {
                var result = await apiInstance.CreatePaymentAsync(accessToken, xeroTenantId, payment);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreatePayment: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$dateValue = new DateTime('2020-10-10');

$invoice = new XeroAPI\XeroPHP\Models\Accounting\Invoice;
$invoice->setInvoiceID('00000000-0000-0000-0000-000000000000');

$account = new XeroAPI\XeroPHP\Models\Accounting\Account;
$account->setAccountID('00000000-0000-0000-0000-000000000000');

$payment = new XeroAPI\XeroPHP\Models\Accounting\Payment;
$payment->setInvoice($invoice);
$payment->setAccount($account);
$payment->setAmount(1.0);
$payment->setDate($dateValue);

$payments = new XeroAPI\XeroPHP\Models\Accounting\Payments;
$arr_payments = [];
array_push($arr_payments, $payment);
$payments->setPayments($arr_payments);

try {
  $result = $apiInstance->createPayment($xeroTenantId, $payment);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createPayment: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $payment = ::Object::Payment->new(); # Payment | 

eval { 
    my $result = $api_instance->createPayment(xeroTenantId => $xeroTenantId, payment => $payment);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createPayment: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_payment():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    date_value = dateutil.parser.parse('2020-10-10T00:00:00Z')

    invoice = Invoice(
        invoice_id = "00000000-0000-0000-0000-000000000000")

    account = Account(
        account_id = "00000000-0000-0000-0000-000000000000")

    payment = Payment(
        invoice = invoice,
        account = account,
        amount = 1.0,
        date = date_value)

    payments = Payments( 
        payments = [payment])
    
    try:
        api_response = api_instance.create_payment(xero_tenant_id, payment)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPayment: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let payment = { "Payments": [ { "Invoice": { "LineItems": [], "InvoiceID": "00000000-0000-0000-0000-000000000000" }, "Account": { "Code": "970" }, "Date": "2019-03-12", "Amount": 1 } ] }; // Payment

    let mut context = AccountingApi::Context::default();
    let result = client.createPayment(xeroTenantId, payment, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
payment *
Payment
Request body with a single Payment object
Required

createPaymentHistory

Creates a history record for a specific payment


/Payments/{PaymentID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Payments/{PaymentID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID paymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createPaymentHistory(accessToken, xeroTenantId, paymentID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createPaymentHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID paymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Payment
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createPaymentHistory(xeroTenantId, paymentID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createPaymentHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *paymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Payment (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific payment
[apiInstance createPaymentHistoryWith:xeroTenantId
    paymentID:paymentID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const paymentID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
    details: "Hello World" }; 

const historyRecords: HistoryRecords = {  
    historyRecords: [historyRecord] }; 

try {
  const response = await xero.accountingApi.createPaymentHistory(xeroTenantId, paymentID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreatePaymentHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var paymentID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreatePaymentHistoryAsync(accessToken, xeroTenantId, paymentID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreatePaymentHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$paymentID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createPaymentHistory($xeroTenantId, $paymentID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createPaymentHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $paymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Payment
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createPaymentHistory(xeroTenantId => $xeroTenantId, paymentID => $paymentID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createPaymentHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_payment_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    payment_id = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    historyRecords = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_payment_history(xero_tenant_id, payment_id, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPaymentHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let paymentID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createPaymentHistory(xeroTenantId, paymentID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
PaymentID*
UUID (uuid)
Unique identifier for a Payment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createPaymentService

Creates a payment service


/PaymentServices

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PaymentServices"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        
        PaymentService paymentService = new PaymentService();
        paymentService.setPaymentServiceName("ACME Payments");
        paymentService.setPaymentServiceUrl("https://www.payupnow.com/");
        paymentService.setPayNowText("Pay Now");
        
        PaymentServices paymentServices = new PaymentServices();
        paymentServices.addPaymentServicesItem(paymentService);

        try {
            PaymentServices result = apiInstance.createPaymentService(accessToken, xeroTenantId, paymentServices);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createPaymentService");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        PaymentServices paymentServices = { "PaymentServices": [ { "PaymentServiceName": "PayUpNow", "PaymentServiceUrl": "https://www.payupnow.com/", "PayNowText": "Time To Pay" } ] }; // PaymentServices | 
        try {
            PaymentServices result = apiInstance.createPaymentService(xeroTenantId, paymentServices);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createPaymentService");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
PaymentServices *paymentServices = { "PaymentServices": [ { "PaymentServiceName": "PayUpNow", "PaymentServiceUrl": "https://www.payupnow.com/", "PayNowText": "Time To Pay" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a payment service
[apiInstance createPaymentServiceWith:xeroTenantId
    paymentServices:paymentServices
              completionHandler: ^(PaymentServices output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';

const paymentService: PaymentService = { 
    paymentServiceName: "ACME Payments",
    paymentServiceUrl: "https://www.payupnow.com/",
    payNowText: "Pay Now" }; 

const paymentServices: PaymentServices = {  
    paymentServices: [paymentService] }; 

try {
  const response = await xero.accountingApi.createPaymentService(xeroTenantId, paymentServices);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreatePaymentServiceExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";

            var paymentService = new PaymentService();
            paymentService.PaymentServiceName = "ACME Payments";
            paymentService.PaymentServiceUrl = "https://www.payupnow.com/";
            paymentService.PayNowText = "Pay Now";

            var paymentServices = new PaymentServices();
            var paymentServicesList = new List<PaymentService>();
            paymentServicesList.Add(paymentService); 
            paymentServices._PaymentServices = paymentServicesList;
            
            try {
                var result = await apiInstance.CreatePaymentServiceAsync(accessToken, xeroTenantId, paymentServices);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreatePaymentService: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

$paymentService = new XeroAPI\XeroPHP\Models\Accounting\PaymentService;
$paymentService->setPaymentServiceName('ACME Payments');
$paymentService->setPaymentServiceUrl('https://www.payupnow.com/');
$paymentService->setPayNowText('Pay Now');

$paymentServices = new XeroAPI\XeroPHP\Models\Accounting\PaymentServices;
$arr_paymentServices = [];
array_push($arr_paymentServices, $paymentService);
$paymentServices->setPaymentServices($arr_paymentServices);

try {
  $result = $apiInstance->createPaymentService($xeroTenantId, $paymentServices);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createPaymentService: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $paymentServices = ::Object::PaymentServices->new(); # PaymentServices | 

eval { 
    my $result = $api_instance->createPaymentService(xeroTenantId => $xeroTenantId, paymentServices => $paymentServices);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createPaymentService: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_payment_service():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'

    payment_service = PaymentService(
        payment_service_name = "ACME Payments",
        payment_service_url = "https://www.payupnow.com/",
        pay_now_text = "Pay Now")

    paymentServices = PaymentServices( 
        paymentServices = [paymentService])
    
    try:
        api_response = api_instance.create_payment_service(xero_tenant_id, paymentServices)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPaymentService: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let paymentServices = { "PaymentServices": [ { "PaymentServiceName": "PayUpNow", "PaymentServiceUrl": "https://www.payupnow.com/", "PayNowText": "Time To Pay" } ] }; // PaymentServices

    let mut context = AccountingApi::Context::default();
    let result = client.createPaymentService(xeroTenantId, paymentServices, &context).wait();
    println!("{:?}", result);

}

Scopes

paymentservices Grant read-write access to payment services

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
paymentServices *
PaymentServices
PaymentServices array with PaymentService object in body of request
Required

createPayments

Creates multiple payments for invoices or credit notes


/Payments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Payments?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        Boolean summarizeErrors = true;
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);
        
        Invoice invoice = new Invoice();
        invoice.setInvoiceID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        Account account = new Account();
        account.setAccountID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        Payment payment = new Payment();
        payment.setInvoice(invoice);
        payment.setAccount(account);
        payment.setAmount(1.0);
        payment.setDate(dateValue);
        
        Payments payments = new Payments();
        payments.addPaymentsItem(payment);

        try {
            Payments result = apiInstance.createPayments(accessToken, xeroTenantId, payments, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createPayments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Payments payments = { "Payments": [ { "Invoice": { "LineItems": [], "InvoiceID": "00000000-0000-0000-0000-000000000000" }, "Account": { "Code": "970" }, "Date": "2019-03-12", "Amount": 1 } ] }; // Payments | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            Payments result = apiInstance.createPayments(xeroTenantId, payments, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createPayments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Payments *payments = { "Payments": [ { "Invoice": { "LineItems": [], "InvoiceID": "00000000-0000-0000-0000-000000000000" }, "Account": { "Code": "970" }, "Date": "2019-03-12", "Amount": 1 } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates multiple payments for invoices or credit notes
[apiInstance createPaymentsWith:xeroTenantId
    payments:payments
    summarizeErrors:summarizeErrors
              completionHandler: ^(Payments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;
const dateValue = '2020-10-10'

const invoice: Invoice = { 
    invoiceID: "00000000-0000-0000-0000-000000000000" }; 

const account: Account = { 
    accountID: "00000000-0000-0000-0000-000000000000" }; 

const payment: Payment = { 
    invoice: invoice,
    account: account,
    amount: 1.0,
    date: dateValue }; 

const payments: Payments = {  
    payments: [payment] }; 

try {
  const response = await xero.accountingApi.createPayments(xeroTenantId, payments,  summarizeErrors);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreatePaymentsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;
            var dateValue = DateTime.Now;

            var invoice = new Invoice();
            invoice.InvoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var account = new Account();
            account.AccountID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var payment = new Payment();
            payment.Invoice = invoice;
            payment.Account = account;
            payment.Amount = new decimal(1.0);
            payment.Date = dateValue;

            var payments = new Payments();
            var paymentsList = new List<Payment>();
            paymentsList.Add(payment); 
            payments._Payments = paymentsList;
            
            try {
                var result = await apiInstance.CreatePaymentsAsync(accessToken, xeroTenantId, payments, summarizeErrors);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreatePayments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$dateValue = new DateTime('2020-10-10');

$invoice = new XeroAPI\XeroPHP\Models\Accounting\Invoice;
$invoice->setInvoiceID('00000000-0000-0000-0000-000000000000');

$account = new XeroAPI\XeroPHP\Models\Accounting\Account;
$account->setAccountID('00000000-0000-0000-0000-000000000000');

$payment = new XeroAPI\XeroPHP\Models\Accounting\Payment;
$payment->setInvoice($invoice);
$payment->setAccount($account);
$payment->setAmount(1.0);
$payment->setDate($dateValue);

$payments = new XeroAPI\XeroPHP\Models\Accounting\Payments;
$arr_payments = [];
array_push($arr_payments, $payment);
$payments->setPayments($arr_payments);

try {
  $result = $apiInstance->createPayments($xeroTenantId, $payments, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createPayments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $payments = ::Object::Payments->new(); # Payments | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->createPayments(xeroTenantId => $xeroTenantId, payments => $payments, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createPayments: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_payments():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'
    date_value = dateutil.parser.parse('2020-10-10T00:00:00Z')

    invoice = Invoice(
        invoice_id = "00000000-0000-0000-0000-000000000000")

    account = Account(
        account_id = "00000000-0000-0000-0000-000000000000")

    payment = Payment(
        invoice = invoice,
        account = account,
        amount = 1.0,
        date = date_value)

    payments = Payments( 
        payments = [payment])
    
    try:
        api_response = api_instance.create_payments(xero_tenant_id, payments, summarize_errors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPayments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let payments = { "Payments": [ { "Invoice": { "LineItems": [], "InvoiceID": "00000000-0000-0000-0000-000000000000" }, "Account": { "Code": "970" }, "Date": "2019-03-12", "Amount": 1 } ] }; // Payments
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.createPayments(xeroTenantId, payments, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
payments *
Payments
Payments array with Payment object in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

createPrepaymentAllocations

Allows you to create an Allocation for prepayments


/Prepayments/{PrepaymentID}/Allocations

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Prepayments/{PrepaymentID}/Allocations?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID prepaymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Boolean summarizeErrors = true;
        LocalDate currDate = LocalDate.now();
        
        Invoice invoice = new Invoice();
        invoice.setInvoiceID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        Allocation allocation = new Allocation();
        allocation.setInvoice(invoice);
        allocation.setAmount(1.0);
        allocation.setDate(currDate);
        
        Allocations allocations = new Allocations();
        allocations.addAllocationsItem(allocation);

        try {
            Allocations result = apiInstance.createPrepaymentAllocations(accessToken, xeroTenantId, prepaymentID, allocations, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createPrepaymentAllocations");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID prepaymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a PrePayment
        Allocations allocations = { "Allocations": [ { "Invoice": { "LineItems": [], "InvoiceID": "00000000-0000-0000-0000-000000000000" }, "Amount": 1, "Date": "2019-01-10" } ] }; // Allocations | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            Allocations result = apiInstance.createPrepaymentAllocations(xeroTenantId, prepaymentID, allocations, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createPrepaymentAllocations");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *prepaymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a PrePayment (default to null)
Allocations *allocations = { "Allocations": [ { "Invoice": { "LineItems": [], "InvoiceID": "00000000-0000-0000-0000-000000000000" }, "Amount": 1, "Date": "2019-01-10" } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Allows you to create an Allocation for prepayments
[apiInstance createPrepaymentAllocationsWith:xeroTenantId
    prepaymentID:prepaymentID
    allocations:allocations
    summarizeErrors:summarizeErrors
              completionHandler: ^(Allocations output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const prepaymentID = '00000000-0000-0000-0000-000000000000';
const summarizeErrors = true;
const currDate = '2020-12-10'

const invoice: Invoice = { 
    invoiceID: "00000000-0000-0000-0000-000000000000" }; 

const allocation: Allocation = { 
    invoice: invoice,
    amount: 1.0,
    date: currDate }; 

const allocations: Allocations = {  
    allocations: [allocation] }; 

try {
  const response = await xero.accountingApi.createPrepaymentAllocations(xeroTenantId, prepaymentID, allocations,  summarizeErrors);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreatePrepaymentAllocationsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var prepaymentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var summarizeErrors = true;
            var currDate = DateTime.Now;

            var invoice = new Invoice();
            invoice.InvoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var allocation = new Allocation();
            allocation.Invoice = invoice;
            allocation.Amount = new decimal(1.0);
            allocation.Date = currDate;

            var allocations = new Allocations();
            var allocationsList = new List<Allocation>();
            allocationsList.Add(allocation); 
            allocations._Allocations = allocationsList;
            
            try {
                var result = await apiInstance.CreatePrepaymentAllocationsAsync(accessToken, xeroTenantId, prepaymentID, allocations, summarizeErrors);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreatePrepaymentAllocations: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$prepaymentID = "00000000-0000-0000-0000-000000000000";
$summarizeErrors = true;
$currDate = new DateTime('2020-12-10');

$invoice = new XeroAPI\XeroPHP\Models\Accounting\Invoice;
$invoice->setInvoiceID('00000000-0000-0000-0000-000000000000');

$allocation = new XeroAPI\XeroPHP\Models\Accounting\Allocation;
$allocation->setInvoice($invoice);
$allocation->setAmount(1.0);
$allocation->setDate($currDate);

$allocations = new XeroAPI\XeroPHP\Models\Accounting\Allocations;
$arr_allocations = [];
array_push($arr_allocations, $allocation);
$allocations->setAllocations($arr_allocations);

try {
  $result = $apiInstance->createPrepaymentAllocations($xeroTenantId, $prepaymentID, $allocations, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createPrepaymentAllocations: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $prepaymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a PrePayment
my $allocations = ::Object::Allocations->new(); # Allocations | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->createPrepaymentAllocations(xeroTenantId => $xeroTenantId, prepaymentID => $prepaymentID, allocations => $allocations, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createPrepaymentAllocations: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_prepayment_allocations():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    prepayment_id = '00000000-0000-0000-0000-000000000000'
    summarize_errors = 'True'
    curr_date = dateutil.parser.parse('2020-12-03T00:00:00Z')

    invoice = Invoice(
        invoice_id = "00000000-0000-0000-0000-000000000000")

    allocation = Allocation(
        invoice = invoice,
        amount = 1.0,
        date = curr_date)

    allocations = Allocations( 
        allocations = [allocation])
    
    try:
        api_response = api_instance.create_prepayment_allocations(xero_tenant_id, prepayment_id, allocations, summarize_errors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPrepaymentAllocations: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let prepaymentID = 00000000-0000-0000-0000-000000000000; // UUID
    let allocations = { "Allocations": [ { "Invoice": { "LineItems": [], "InvoiceID": "00000000-0000-0000-0000-000000000000" }, "Amount": 1, "Date": "2019-01-10" } ] }; // Allocations
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.createPrepaymentAllocations(xeroTenantId, prepaymentID, allocations, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
PrepaymentID*
UUID (uuid)
Unique identifier for a PrePayment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
allocations *
Allocations
Allocations with an array of Allocation object in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

createPrepaymentHistory

Creates a history record for a specific prepayment


/Prepayments/{PrepaymentID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Prepayments/{PrepaymentID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID prepaymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createPrepaymentHistory(accessToken, xeroTenantId, prepaymentID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createPrepaymentHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID prepaymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a PrePayment
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createPrepaymentHistory(xeroTenantId, prepaymentID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createPrepaymentHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *prepaymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a PrePayment (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific prepayment
[apiInstance createPrepaymentHistoryWith:xeroTenantId
    prepaymentID:prepaymentID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const prepaymentID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
    details: "Hello World" }; 

const historyRecords: HistoryRecords = {  
    historyRecords: [historyRecord] }; 

try {
  const response = await xero.accountingApi.createPrepaymentHistory(xeroTenantId, prepaymentID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreatePrepaymentHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var prepaymentID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreatePrepaymentHistoryAsync(accessToken, xeroTenantId, prepaymentID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreatePrepaymentHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$prepaymentID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createPrepaymentHistory($xeroTenantId, $prepaymentID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createPrepaymentHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $prepaymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a PrePayment
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createPrepaymentHistory(xeroTenantId => $xeroTenantId, prepaymentID => $prepaymentID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createPrepaymentHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_prepayment_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    prepayment_id = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    historyRecords = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_prepayment_history(xero_tenant_id, prepayment_id, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPrepaymentHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let prepaymentID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createPrepaymentHistory(xeroTenantId, prepaymentID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
PrepaymentID*
UUID (uuid)
Unique identifier for a PrePayment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createPurchaseOrderAttachmentByFileName

Creates attachment for a specific purchase order


/PurchaseOrders/{PurchaseOrderID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders/{PurchaseOrderID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID purchaseOrderID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.createPurchaseOrderAttachmentByFileName(accessToken, xeroTenantId, purchaseOrderID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createPurchaseOrderAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Purchase Order
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.createPurchaseOrderAttachmentByFileName(xeroTenantId, purchaseOrderID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createPurchaseOrderAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *purchaseOrderID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Purchase Order (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates attachment for a specific purchase order
[apiInstance createPurchaseOrderAttachmentByFileNameWith:xeroTenantId
    purchaseOrderID:purchaseOrderID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const purchaseOrderID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createPurchaseOrderAttachmentByFileName(xeroTenantId, purchaseOrderID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreatePurchaseOrderAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var purchaseOrderID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.CreatePurchaseOrderAttachmentByFileNameAsync(accessToken, xeroTenantId, purchaseOrderID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreatePurchaseOrderAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$purchaseOrderID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->createPurchaseOrderAttachmentByFileName($xeroTenantId, $purchaseOrderID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createPurchaseOrderAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrderID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Purchase Order
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->createPurchaseOrderAttachmentByFileName(xeroTenantId => $xeroTenantId, purchaseOrderID => $purchaseOrderID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createPurchaseOrderAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_purchase_order_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    purchase_order_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.create_purchase_order_attachment_by_file_name(xero_tenant_id, purchase_order_id, file_name, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPurchaseOrderAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.createPurchaseOrderAttachmentByFileName(xeroTenantId, purchaseOrderID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
PurchaseOrderID*
UUID (uuid)
Unique identifier for an Purchase Order
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

createPurchaseOrderHistory

Creates a history record for a specific purchase orders


/PurchaseOrders/{PurchaseOrderID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders/{PurchaseOrderID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID purchaseOrderID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createPurchaseOrderHistory(accessToken, xeroTenantId, purchaseOrderID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createPurchaseOrderHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Purchase Order
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createPurchaseOrderHistory(xeroTenantId, purchaseOrderID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createPurchaseOrderHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *purchaseOrderID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Purchase Order (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific purchase orders
[apiInstance createPurchaseOrderHistoryWith:xeroTenantId
    purchaseOrderID:purchaseOrderID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const purchaseOrderID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
    details: "Hello World" }; 

const historyRecords: HistoryRecords = {  
    historyRecords: [historyRecord] }; 

try {
  const response = await xero.accountingApi.createPurchaseOrderHistory(xeroTenantId, purchaseOrderID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreatePurchaseOrderHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var purchaseOrderID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreatePurchaseOrderHistoryAsync(accessToken, xeroTenantId, purchaseOrderID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreatePurchaseOrderHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$purchaseOrderID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createPurchaseOrderHistory($xeroTenantId, $purchaseOrderID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createPurchaseOrderHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrderID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Purchase Order
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createPurchaseOrderHistory(xeroTenantId => $xeroTenantId, purchaseOrderID => $purchaseOrderID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createPurchaseOrderHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_purchase_order_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    purchase_order_id = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    historyRecords = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_purchase_order_history(xero_tenant_id, purchase_order_id, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPurchaseOrderHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createPurchaseOrderHistory(xeroTenantId, purchaseOrderID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
PurchaseOrderID*
UUID (uuid)
Unique identifier for an Purchase Order
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createPurchaseOrders

Creates one or more purchase orders


/PurchaseOrders

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        Boolean summarizeErrors = true;
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);
        
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");

        List<LineItem> lineItems = new ArrayList<LineItem>();
        lineItems.add(lineItem);
        
        PurchaseOrder purchaseOrder = new PurchaseOrder();
        purchaseOrder.setContact(contact);
        purchaseOrder.setLineItems(lineItems);
        purchaseOrder.setDate(dateValue);
        
        PurchaseOrders purchaseOrders = new PurchaseOrders();
        purchaseOrders.addPurchaseOrdersItem(purchaseOrder);

        try {
            PurchaseOrders result = apiInstance.createPurchaseOrders(accessToken, xeroTenantId, purchaseOrders, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createPurchaseOrders");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        PurchaseOrders purchaseOrders = { "PurchaseOrders": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "LineItems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "710" } ], "Date": "2019-03-13" } ] }; // PurchaseOrders | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            PurchaseOrders result = apiInstance.createPurchaseOrders(xeroTenantId, purchaseOrders, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createPurchaseOrders");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
PurchaseOrders *purchaseOrders = { "PurchaseOrders": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "LineItems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "710" } ], "Date": "2019-03-13" } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates one or more purchase orders
[apiInstance createPurchaseOrdersWith:xeroTenantId
    purchaseOrders:purchaseOrders
    summarizeErrors:summarizeErrors
              completionHandler: ^(PurchaseOrders output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;
const dateValue = '2020-10-10'

const contact: Contact = { 
    contactID: "00000000-0000-0000-0000-000000000000" }; 

const lineItem: LineItem = { 
    description: "Foobar",
    quantity: 1.0,
    unitAmount: 20.0,
    accountCode: "000" };   
const lineItems = [];    
lineItems.push(lineItem)

const purchaseOrder: PurchaseOrder = { 
    contact: contact,
    lineItems: lineItems,
    date: dateValue }; 

const purchaseOrders: PurchaseOrders = {  
    purchaseOrders: [purchaseOrder] }; 

try {
  const response = await xero.accountingApi.createPurchaseOrders(xeroTenantId, purchaseOrders,  summarizeErrors);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreatePurchaseOrdersExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;
            var dateValue = DateTime.Now;

            var contact = new Contact();
            contact.ContactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var lineItem = new LineItem();
            lineItem.Description = "Foobar";
            lineItem.Quantity = new decimal(1.0);
            lineItem.UnitAmount = new decimal(20.0);
            lineItem.AccountCode = "000";
            var lineItems = new List<LineItem>();
            lineItems.Add(lineItem);

            var purchaseOrder = new PurchaseOrder();
            purchaseOrder.Contact = contact;
            purchaseOrder.LineItems = lineItems;
            purchaseOrder.Date = dateValue;

            var purchaseOrders = new PurchaseOrders();
            var purchaseOrdersList = new List<PurchaseOrder>();
            purchaseOrdersList.Add(purchaseOrder); 
            purchaseOrders._PurchaseOrders = purchaseOrdersList;
            
            try {
                var result = await apiInstance.CreatePurchaseOrdersAsync(accessToken, xeroTenantId, purchaseOrders, summarizeErrors);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreatePurchaseOrders: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$dateValue = new DateTime('2020-12-10');

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItems = [];
array_push($lineItems, $lineItem);

$purchaseOrder = new XeroAPI\XeroPHP\Models\Accounting\PurchaseOrder;
$purchaseOrder->setContact($contact);
$purchaseOrder->setLineItems($lineItems);
$purchaseOrder->setDate($dateValue);

$purchaseOrders = new XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders;
$arr_purchase_orders = [];
array_push($arr_purchase_orders, $purchaseOrder);
$purchaseOrders->setPurchaseOrders($arr_purchase_orders);

try {
  $result = $apiInstance->createPurchaseOrders($xeroTenantId, $purchaseOrders, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createPurchaseOrders: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrders = ::Object::PurchaseOrders->new(); # PurchaseOrders | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->createPurchaseOrders(xeroTenantId => $xeroTenantId, purchaseOrders => $purchaseOrders, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createPurchaseOrders: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_purchase_orders():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'
    date_value = dateutil.parser.parse('2020-12-03T00:00:00Z')

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000")
    
    line_items = []    
    line_items.append(line_item)

    purchase_order = PurchaseOrder(
        contact = contact,
        line_items = line_items,
        date = date_value)

    purchaseOrders = PurchaseOrders( 
        purchase_orders = [purchase_order])
    
    try:
        api_response = api_instance.create_purchase_orders(xero_tenant_id, purchaseOrders, summarize_errors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createPurchaseOrders: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrders = { "PurchaseOrders": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "LineItems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "710" } ], "Date": "2019-03-13" } ] }; // PurchaseOrders
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.createPurchaseOrders(xeroTenantId, purchaseOrders, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
purchaseOrders *
PurchaseOrders
PurchaseOrders with an array of PurchaseOrder object in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

createQuoteAttachmentByFileName

Creates attachment for a specific quote


/Quotes/{QuoteID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes/{QuoteID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID quoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.createQuoteAttachmentByFileName(accessToken, xeroTenantId, quoteID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createQuoteAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID quoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Quote
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.createQuoteAttachmentByFileName(xeroTenantId, quoteID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createQuoteAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *quoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Quote (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates attachment for a specific quote
[apiInstance createQuoteAttachmentByFileNameWith:xeroTenantId
    quoteID:quoteID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const quoteID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createQuoteAttachmentByFileName(xeroTenantId, quoteID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateQuoteAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var quoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.CreateQuoteAttachmentByFileNameAsync(accessToken, xeroTenantId, quoteID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateQuoteAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$quoteID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->createQuoteAttachmentByFileName($xeroTenantId, $quoteID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createQuoteAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $quoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Quote
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->createQuoteAttachmentByFileName(xeroTenantId => $xeroTenantId, quoteID => $quoteID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createQuoteAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_quote_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    quote_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.create_quote_attachment_by_file_name(xero_tenant_id, quote_id, file_name, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createQuoteAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let quoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.createQuoteAttachmentByFileName(xeroTenantId, quoteID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
QuoteID*
UUID (uuid)
Unique identifier for an Quote
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

createQuoteHistory

Creates a history record for a specific quote


/Quotes/{QuoteID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes/{QuoteID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID quoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createQuoteHistory(accessToken, xeroTenantId, quoteID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createQuoteHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID quoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Quote
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createQuoteHistory(xeroTenantId, quoteID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createQuoteHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *quoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Quote (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific quote
[apiInstance createQuoteHistoryWith:xeroTenantId
    quoteID:quoteID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const quoteID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
    details: "Hello World" }; 

const historyRecords: HistoryRecords = {  
    historyRecords: [historyRecord] }; 

try {
  const response = await xero.accountingApi.createQuoteHistory(xeroTenantId, quoteID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateQuoteHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var quoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateQuoteHistoryAsync(accessToken, xeroTenantId, quoteID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateQuoteHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$quoteID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createQuoteHistory($xeroTenantId, $quoteID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createQuoteHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $quoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Quote
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createQuoteHistory(xeroTenantId => $xeroTenantId, quoteID => $quoteID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createQuoteHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_quote_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    quote_id = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    historyRecords = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_quote_history(xero_tenant_id, quote_id, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createQuoteHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let quoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createQuoteHistory(xeroTenantId, quoteID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
QuoteID*
UUID (uuid)
Unique identifier for an Quote
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createQuotes

Create one or more quotes


/Quotes

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        Boolean summarizeErrors = true;
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);
        
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");

        List<LineItem> lineItems = new ArrayList<LineItem>();
        lineItems.add(lineItem);
        
        Quote quote = new Quote();
        quote.setContact(contact);
        quote.setLineItems(lineItems);
        quote.setDate(dateValue);
        
        Quotes quotes = new Quotes();
        quotes.addQuotesItem(quote);

        try {
            Quotes result = apiInstance.createQuotes(accessToken, xeroTenantId, quotes, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createQuotes");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Quotes quotes = { "Quotes": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "LineItems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "12775" } ], "Date": "2020-02-01" } ] }; // Quotes | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            Quotes result = apiInstance.createQuotes(xeroTenantId, quotes, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createQuotes");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Quotes *quotes = { "Quotes": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "LineItems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "12775" } ], "Date": "2020-02-01" } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Create one or more quotes
[apiInstance createQuotesWith:xeroTenantId
    quotes:quotes
    summarizeErrors:summarizeErrors
              completionHandler: ^(Quotes output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;
const dateValue = '2020-10-10'

const contact: Contact = { 
    contactID: "00000000-0000-0000-0000-000000000000" }; 

const lineItem: LineItem = { 
    description: "Foobar",
    quantity: 1.0,
    unitAmount: 20.0,
    accountCode: "000" };   
const lineItems = [];    
lineItems.push(lineItem)

const quote: Quote = { 
    contact: contact,
    lineItems: lineItems,
    date: dateValue }; 

const quotes: Quotes = {  
    quotes: [quote] }; 

try {
  const response = await xero.accountingApi.createQuotes(xeroTenantId, quotes,  summarizeErrors);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateQuotesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;
            var dateValue = DateTime.Now;

            var contact = new Contact();
            contact.ContactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var lineItem = new LineItem();
            lineItem.Description = "Foobar";
            lineItem.Quantity = new decimal(1.0);
            lineItem.UnitAmount = new decimal(20.0);
            lineItem.AccountCode = "000";
            var lineItems = new List<LineItem>();
            lineItems.Add(lineItem);

            var quote = new Quote();
            quote.Contact = contact;
            quote.LineItems = lineItems;
            quote.Date = dateValue;

            var quotes = new Quotes();
            var quotesList = new List<Quote>();
            quotesList.Add(quote); 
            quotes._Quotes = quotesList;
            
            try {
                var result = await apiInstance.CreateQuotesAsync(accessToken, xeroTenantId, quotes, summarizeErrors);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateQuotes: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$dateValue = new DateTime('2020-12-10');

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItems = [];
array_push($lineItems, $lineItem);

$quote = new XeroAPI\XeroPHP\Models\Accounting\Quote;
$quote->setContact($contact);
$quote->setLineItems($lineItems);
$quote->setDate($dateValue);

$quotes = new XeroAPI\XeroPHP\Models\Accounting\Quotes;
$arr_quotes = [];
array_push($arr_quotes, $quote);
$quotes->setQuotes($arr_quotes);

try {
  $result = $apiInstance->createQuotes($xeroTenantId, $quotes, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createQuotes: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $quotes = ::Object::Quotes->new(); # Quotes | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->createQuotes(xeroTenantId => $xeroTenantId, quotes => $quotes, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createQuotes: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_quotes():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'
    date_value = dateutil.parser.parse('2020-12-03T00:00:00Z')

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000")
    
    line_items = []    
    line_items.append(line_item)

    quote = Quote(
        contact = contact,
        line_items = line_items,
        date = date_value)

    quotes = Quotes( 
        quotes = [quote])
    
    try:
        api_response = api_instance.create_quotes(xero_tenant_id, quotes, summarize_errors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createQuotes: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let quotes = { "Quotes": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "LineItems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "12775" } ], "Date": "2020-02-01" } ] }; // Quotes
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.createQuotes(xeroTenantId, quotes, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
quotes *
Quotes
Quotes with an array of Quote object in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

createReceipt

Creates draft expense claim receipts for any user


/Receipts

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Receipts?unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        Integer unitdp = 4;
        
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        User user = new User();
        user.setUserID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");

        List<LineItem> lineItems = new ArrayList<LineItem>();
        lineItems.add(lineItem);
        
        Receipt receipt = new Receipt();
        receipt.setContact(contact);
        receipt.setUser(user);
        receipt.setLineItems(lineItems);
        receipt.setLineAmountTypes(com.xero.models.accounting.LineAmountTypes.INCLUSIVE);
        receipt.setStatus(com.xero.models.accounting.Receipt.StatusEnum.DRAFT);
        
        Receipts receipts = new Receipts();
        receipts.addReceiptsItem(receipt);

        try {
            Receipts result = apiInstance.createReceipt(accessToken, xeroTenantId, receipts, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createReceipt");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Receipts receipts = { "Receipts": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "Lineitems": [ { "Description": "Foobar", "Quantity": 2, "UnitAmount": 20, "AccountCode": "400", "TaxType": "NONE", "LineAmount": 40 } ], "User": { "UserID": "00000000-0000-0000-0000-000000000000" }, "LineAmountTypes": "NoTax", "Status": "DRAFT" } ] }; // Receipts | 
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Receipts result = apiInstance.createReceipt(xeroTenantId, receipts, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createReceipt");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Receipts *receipts = { "Receipts": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "Lineitems": [ { "Description": "Foobar", "Quantity": 2, "UnitAmount": 20, "AccountCode": "400", "TaxType": "NONE", "LineAmount": 40 } ], "User": { "UserID": "00000000-0000-0000-0000-000000000000" }, "LineAmountTypes": "NoTax", "Status": "DRAFT" } ] }; // 
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates draft expense claim receipts for any user
[apiInstance createReceiptWith:xeroTenantId
    receipts:receipts
    unitdp:unitdp
              completionHandler: ^(Receipts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const unitdp = 4;

const contact: Contact = { 
    contactID: "00000000-0000-0000-0000-000000000000" }; 

const user: User = { 
    userID: "00000000-0000-0000-0000-000000000000" }; 

const lineItem: LineItem = { 
    description: "Foobar",
    quantity: 1.0,
    unitAmount: 20.0,
    accountCode: "000" };   
const lineItems = [];    
lineItems.push(lineItem)

const receipt: Receipt = { 
    contact: contact,
    user: user,
    lineItems: lineItems,
    lineAmountTypes: LineAmountTypes.Inclusive,
    status: Receipt.StatusEnum.DRAFT }; 

const receipts: Receipts = {  
    receipts: [receipt] }; 

try {
  const response = await xero.accountingApi.createReceipt(xeroTenantId, receipts,  unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateReceiptExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var unitdp = 4;

            var contact = new Contact();
            contact.ContactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var user = new User();
            user.UserID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var lineItem = new LineItem();
            lineItem.Description = "Foobar";
            lineItem.Quantity = new decimal(1.0);
            lineItem.UnitAmount = new decimal(20.0);
            lineItem.AccountCode = "000";
            var lineItems = new List<LineItem>();
            lineItems.Add(lineItem);

            var receipt = new Receipt();
            receipt.Contact = contact;
            receipt.User = user;
            receipt.LineItems = lineItems;
            receipt.LineAmountTypes = LineAmountTypes.Exclusive;
            receipt.Status = Receipt.StatusEnum.DRAFT;

            var receipts = new Receipts();
            var receiptsList = new List<Receipt>();
            receiptsList.Add(receipt); 
            receipts._Receipts = receiptsList;
            
            try {
                var result = await apiInstance.CreateReceiptAsync(accessToken, xeroTenantId, receipts, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateReceipt: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$unitdp = 4;

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$user = new XeroAPI\XeroPHP\Models\Accounting\User;
$user->setUserID('00000000-0000-0000-0000-000000000000');

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItems = [];
array_push($lineItems, $lineItem);

$receipt = new XeroAPI\XeroPHP\Models\Accounting\Receipt;
$receipt->setContact($contact);
$receipt->setUser($user);
$receipt->setLineItems($lineItems);
$receipt->setLineAmountTypes(XeroAPI\XeroPHP\Models\Accounting\LineAmountTypes::INCLUSIVE);
$receipt->setStatus(XeroAPI\XeroPHP\Models\Accounting\Receipt::STATUS_DRAFT);

$receipts = new XeroAPI\XeroPHP\Models\Accounting\Receipts;
$arr_receipts = [];
array_push($arr_receipts, $receipt);
$receipts->setReceipts($arr_receipts);

try {
  $result = $apiInstance->createReceipt($xeroTenantId, $receipts, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createReceipt: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $receipts = ::Object::Receipts->new(); # Receipts | 
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->createReceipt(xeroTenantId => $xeroTenantId, receipts => $receipts, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createReceipt: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_receipt():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    user = User(
        user_id = "00000000-0000-0000-0000-000000000000")

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000")
    
    line_items = []    
    line_items.append(line_item)

    receipt = Receipt(
        contact = contact,
        user = user,
        line_items = line_items,
        line_amount_types = LineAmountTypes.INCLUSIVE,
        status = "DRAFT")

    receipts = Receipts( 
        receipts = [receipt])
    
    try:
        api_response = api_instance.create_receipt(xero_tenant_id, receipts, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createReceipt: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let receipts = { "Receipts": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "Lineitems": [ { "Description": "Foobar", "Quantity": 2, "UnitAmount": 20, "AccountCode": "400", "TaxType": "NONE", "LineAmount": 40 } ], "User": { "UserID": "00000000-0000-0000-0000-000000000000" }, "LineAmountTypes": "NoTax", "Status": "DRAFT" } ] }; // Receipts
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.createReceipt(xeroTenantId, receipts, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
receipts *
Receipts
Receipts with an array of Receipt object in body of request
Required
Query parameters
Name Description
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

createReceiptAttachmentByFileName

Creates an attachment on a specific expense claim receipts by file name


/Receipts/{ReceiptID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Receipts/{ReceiptID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID receiptID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.createReceiptAttachmentByFileName(accessToken, xeroTenantId, receiptID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createReceiptAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID receiptID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Receipt
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.createReceiptAttachmentByFileName(xeroTenantId, receiptID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createReceiptAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *receiptID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Receipt (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates an attachment on a specific expense claim receipts by file name
[apiInstance createReceiptAttachmentByFileNameWith:xeroTenantId
    receiptID:receiptID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const receiptID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createReceiptAttachmentByFileName(xeroTenantId, receiptID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateReceiptAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var receiptID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.CreateReceiptAttachmentByFileNameAsync(accessToken, xeroTenantId, receiptID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateReceiptAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$receiptID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->createReceiptAttachmentByFileName($xeroTenantId, $receiptID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createReceiptAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $receiptID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Receipt
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->createReceiptAttachmentByFileName(xeroTenantId => $xeroTenantId, receiptID => $receiptID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createReceiptAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_receipt_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    receipt_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.create_receipt_attachment_by_file_name(xero_tenant_id, receipt_id, file_name, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createReceiptAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let receiptID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.createReceiptAttachmentByFileName(xeroTenantId, receiptID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
ReceiptID*
UUID (uuid)
Unique identifier for a Receipt
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

createReceiptHistory

Creates a history record for a specific receipt


/Receipts/{ReceiptID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Receipts/{ReceiptID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID receiptID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createReceiptHistory(accessToken, xeroTenantId, receiptID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createReceiptHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID receiptID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Receipt
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createReceiptHistory(xeroTenantId, receiptID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createReceiptHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *receiptID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Receipt (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a history record for a specific receipt
[apiInstance createReceiptHistoryWith:xeroTenantId
    receiptID:receiptID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const receiptID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
    details: "Hello World" }; 

const historyRecords: HistoryRecords = {  
    historyRecords: [historyRecord] }; 

try {
  const response = await xero.accountingApi.createReceiptHistory(xeroTenantId, receiptID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateReceiptHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var receiptID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateReceiptHistoryAsync(accessToken, xeroTenantId, receiptID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateReceiptHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$receiptID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createReceiptHistory($xeroTenantId, $receiptID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createReceiptHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $receiptID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Receipt
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createReceiptHistory(xeroTenantId => $xeroTenantId, receiptID => $receiptID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createReceiptHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_receipt_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    receipt_id = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    historyRecords = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_receipt_history(xero_tenant_id, receipt_id, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createReceiptHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let receiptID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createReceiptHistory(xeroTenantId, receiptID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
ReceiptID*
UUID (uuid)
Unique identifier for a Receipt
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createRepeatingInvoiceAttachmentByFileName

Creates an attachment from a specific repeating invoices by file name


/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID repeatingInvoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.createRepeatingInvoiceAttachmentByFileName(accessToken, xeroTenantId, repeatingInvoiceID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createRepeatingInvoiceAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Repeating Invoice
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.createRepeatingInvoiceAttachmentByFileName(xeroTenantId, repeatingInvoiceID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createRepeatingInvoiceAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Repeating Invoice (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates an attachment from a specific repeating invoices by file name
[apiInstance createRepeatingInvoiceAttachmentByFileNameWith:xeroTenantId
    repeatingInvoiceID:repeatingInvoiceID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const repeatingInvoiceID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.createRepeatingInvoiceAttachmentByFileName(xeroTenantId, repeatingInvoiceID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateRepeatingInvoiceAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var repeatingInvoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.CreateRepeatingInvoiceAttachmentByFileNameAsync(accessToken, xeroTenantId, repeatingInvoiceID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateRepeatingInvoiceAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$repeatingInvoiceID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->createRepeatingInvoiceAttachmentByFileName($xeroTenantId, $repeatingInvoiceID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createRepeatingInvoiceAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Repeating Invoice
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->createRepeatingInvoiceAttachmentByFileName(xeroTenantId => $xeroTenantId, repeatingInvoiceID => $repeatingInvoiceID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createRepeatingInvoiceAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_repeating_invoice_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    repeating_invoice_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.create_repeating_invoice_attachment_by_file_name(xero_tenant_id, repeating_invoice_id, file_name, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createRepeatingInvoiceAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.createRepeatingInvoiceAttachmentByFileName(xeroTenantId, repeatingInvoiceID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
RepeatingInvoiceID*
UUID (uuid)
Unique identifier for a Repeating Invoice
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

createRepeatingInvoiceHistory

Creates a history record for a specific repeating invoice


/RepeatingInvoices/{RepeatingInvoiceID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/RepeatingInvoices/{RepeatingInvoiceID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID repeatingInvoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        HistoryRecord historyRecord = new HistoryRecord();
        historyRecord.setDetails("Hello World");
        
        HistoryRecords historyRecords = new HistoryRecords();
        historyRecords.addHistoryRecordsItem(historyRecord);

        try {
            HistoryRecords result = apiInstance.createRepeatingInvoiceHistory(accessToken, xeroTenantId, repeatingInvoiceID, historyRecords);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createRepeatingInvoiceHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Repeating Invoice
        HistoryRecords historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords | 
        try {
            HistoryRecords result = apiInstance.createRepeatingInvoiceHistory(xeroTenantId, repeatingInvoiceID, historyRecords);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createRepeatingInvoiceHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Repeating Invoice (default to null)
HistoryRecords *historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a  history record for a specific repeating invoice
[apiInstance createRepeatingInvoiceHistoryWith:xeroTenantId
    repeatingInvoiceID:repeatingInvoiceID
    historyRecords:historyRecords
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const repeatingInvoiceID = '00000000-0000-0000-0000-000000000000';

const historyRecord: HistoryRecord = { 
    details: "Hello World" }; 

const historyRecords: HistoryRecords = {  
    historyRecords: [historyRecord] }; 

try {
  const response = await xero.accountingApi.createRepeatingInvoiceHistory(xeroTenantId, repeatingInvoiceID, historyRecords);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateRepeatingInvoiceHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var repeatingInvoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var historyRecord = new HistoryRecord();
            historyRecord.Details = "Hello World";

            var historyRecords = new HistoryRecords();
            var historyRecordsList = new List<HistoryRecord>();
            historyRecordsList.Add(historyRecord); 
            historyRecords._HistoryRecords = historyRecordsList;
            
            try {
                var result = await apiInstance.CreateRepeatingInvoiceHistoryAsync(accessToken, xeroTenantId, repeatingInvoiceID, historyRecords);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateRepeatingInvoiceHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$repeatingInvoiceID = "00000000-0000-0000-0000-000000000000";

$historyRecord = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecord;
$historyRecord->setDetails('Hello World');

$historyRecords = new XeroAPI\XeroPHP\Models\Accounting\HistoryRecords;
$arr_history_records = [];
array_push($arr_history_records, $historyRecord);
$historyRecords->setHistoryRecords($arr_history_records);

try {
  $result = $apiInstance->createRepeatingInvoiceHistory($xeroTenantId, $repeatingInvoiceID, $historyRecords);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createRepeatingInvoiceHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Repeating Invoice
my $historyRecords = ::Object::HistoryRecords->new(); # HistoryRecords | 

eval { 
    my $result = $api_instance->createRepeatingInvoiceHistory(xeroTenantId => $xeroTenantId, repeatingInvoiceID => $repeatingInvoiceID, historyRecords => $historyRecords);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createRepeatingInvoiceHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_repeating_invoice_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    repeating_invoice_id = '00000000-0000-0000-0000-000000000000'

    history_record = HistoryRecord(
        details = "Hello World")

    historyRecords = HistoryRecords( 
        history_records = [history_record])
    
    try:
        api_response = api_instance.create_repeating_invoice_history(xero_tenant_id, repeating_invoice_id, historyRecords)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createRepeatingInvoiceHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let historyRecords = { "HistoryRecords": [ { "Details": "Hello World" } ] }; // HistoryRecords

    let mut context = AccountingApi::Context::default();
    let result = client.createRepeatingInvoiceHistory(xeroTenantId, repeatingInvoiceID, historyRecords, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
RepeatingInvoiceID*
UUID (uuid)
Unique identifier for a Repeating Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
historyRecords *
HistoryRecords
HistoryRecords containing an array of HistoryRecord objects in body of request
Required

createTaxRates

Creates one or more tax rates


/TaxRates

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/TaxRates"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        
        TaxComponent taxComponent = new TaxComponent();
        taxComponent.setName("State Tax");
        taxComponent.setRate(2.25);

        List<TaxComponent> taxComponent = new ArrayList<TaxComponent>();
        taxComponents.add(taxComponent);
        
        TaxRate taxRate = new TaxRate();
        taxRate.setName("CA State Tax");
        taxRate.setTaxComponents(taxComponents);
        
        TaxRates taxRates = new TaxRates();
        taxRates.addTaxRatesItem(taxRate);

        try {
            TaxRates result = apiInstance.createTaxRates(accessToken, xeroTenantId, taxRates);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createTaxRates");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        TaxRates taxRates = { "TaxRates": [ { "Name": "CA State Tax", "TaxComponents": [ { "Name": "State Tax", "Rate": 2.25 } ] } ] }; // TaxRates | 
        try {
            TaxRates result = apiInstance.createTaxRates(xeroTenantId, taxRates);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createTaxRates");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
TaxRates *taxRates = { "TaxRates": [ { "Name": "CA State Tax", "TaxComponents": [ { "Name": "State Tax", "Rate": 2.25 } ] } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates one or more tax rates
[apiInstance createTaxRatesWith:xeroTenantId
    taxRates:taxRates
              completionHandler: ^(TaxRates output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';

const taxComponent: TaxComponent = { 
    name: "State Tax",
    rate: 2.25 };   
const taxComponent = [];    
taxComponents.push(taxComponent)

const taxRate: TaxRate = { 
    name: "CA State Tax",
    taxComponents: taxComponents,

const taxRates: TaxRates = {  
    taxRates: [taxRate] }; 

try {
  const response = await xero.accountingApi.createTaxRates(xeroTenantId, taxRates);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateTaxRatesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";

            var taxComponent = new TaxComponent();
            taxComponent.Name = "State Tax";
            taxComponent.Rate = new decimal(2.25);
            var taxComponent = new List<TaxComponent>();
            taxComponents.Add(taxComponent);

            var taxRate = new TaxRate();
            taxRate.Name = "CA State Tax";
            taxRate.TaxComponents = taxComponents;

            var taxRates = new TaxRates();
            var taxRatesList = new List<TaxRate>();
            taxRatesList.Add(taxRate); 
            taxRates._TaxRates = taxRatesList;
            
            try {
                var result = await apiInstance.CreateTaxRatesAsync(accessToken, xeroTenantId, taxRates);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateTaxRates: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

$taxComponent = new XeroAPI\XeroPHP\Models\Accounting\TaxComponent;
$taxComponent->setName('State Tax');
$taxComponent->setRate(2.25);
$taxComponent = [];
array_push($taxComponents, $taxComponent);

$taxRate = new XeroAPI\XeroPHP\Models\Accounting\TaxRate;
$taxRate->setName('CA State Tax');
$taxRate->setTaxComponents($taxComponents);

$taxRates = new XeroAPI\XeroPHP\Models\Accounting\TaxRates;
$arr_tax_rates = [];
array_push($arr_tax_rates, $taxRate);
$taxRates->setTaxRates($arr_tax_rates);

try {
  $result = $apiInstance->createTaxRates($xeroTenantId, $taxRates);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createTaxRates: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $taxRates = ::Object::TaxRates->new(); # TaxRates | 

eval { 
    my $result = $api_instance->createTaxRates(xeroTenantId => $xeroTenantId, taxRates => $taxRates);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createTaxRates: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_tax_rates():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'

    tax_component = TaxComponent(
        name = "State Tax",
        rate = 2.25)
    
    taxComponent = []    
    tax_components.append(tax_component)

    tax_rate = TaxRate(
        name = "CA State Tax",
        taxComponents = taxComponents,

    taxRates = TaxRates( 
        tax_rates = [tax_rate])
    
    try:
        api_response = api_instance.create_tax_rates(xero_tenant_id, taxRates)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createTaxRates: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let taxRates = { "TaxRates": [ { "Name": "CA State Tax", "TaxComponents": [ { "Name": "State Tax", "Rate": 2.25 } ] } ] }; // TaxRates

    let mut context = AccountingApi::Context::default();
    let result = client.createTaxRates(xeroTenantId, taxRates, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
taxRates *
TaxRates
TaxRates array with TaxRate object in body of request
Required

createTrackingCategory

Create tracking categories


/TrackingCategories

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/TrackingCategories"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        
        TrackingCategory trackingCategory = new TrackingCategory();
        trackingCategory.setName("Foobar");

        try {
            TrackingCategories result = apiInstance.createTrackingCategory(accessToken, xeroTenantId, trackingCategory);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createTrackingCategory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        TrackingCategory trackingCategory = { name: "FooBar" }; // TrackingCategory | 
        try {
            TrackingCategories result = apiInstance.createTrackingCategory(xeroTenantId, trackingCategory);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createTrackingCategory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
TrackingCategory *trackingCategory = { name: "FooBar" }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Create tracking categories
[apiInstance createTrackingCategoryWith:xeroTenantId
    trackingCategory:trackingCategory
              completionHandler: ^(TrackingCategories output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';

const trackingCategory: TrackingCategory = { 
    name: "Foobar" }; 

try {
  const response = await xero.accountingApi.createTrackingCategory(xeroTenantId, trackingCategory);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateTrackingCategoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";

            var trackingCategory = new TrackingCategory();
            trackingCategory.Name = "Foobar";
            
            try {
                var result = await apiInstance.CreateTrackingCategoryAsync(accessToken, xeroTenantId, trackingCategory);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateTrackingCategory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

$trackingCategory = new XeroAPI\XeroPHP\Models\Accounting\TrackingCategory;
$trackingCategory->setName('Foobar');

try {
  $result = $apiInstance->createTrackingCategory($xeroTenantId, $trackingCategory);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createTrackingCategory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $trackingCategory = ::Object::TrackingCategory->new(); # TrackingCategory | 

eval { 
    my $result = $api_instance->createTrackingCategory(xeroTenantId => $xeroTenantId, trackingCategory => $trackingCategory);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createTrackingCategory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_tracking_category():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'

    trackingCategory = TrackingCategory(
        name = "Foobar")
    
    try:
        api_response = api_instance.create_tracking_category(xero_tenant_id, trackingCategory)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createTrackingCategory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let trackingCategory = { name: "FooBar" }; // TrackingCategory

    let mut context = AccountingApi::Context::default();
    let result = client.createTrackingCategory(xeroTenantId, trackingCategory, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
trackingCategory *
TrackingCategory
TrackingCategory object in body of request
Required

createTrackingOptions

Creates options for a specific tracking category


/TrackingCategories/{TrackingCategoryID}/Options

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/TrackingCategories/{TrackingCategoryID}/Options"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID trackingCategoryID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        TrackingOption trackingOption = new TrackingOption();
        trackingOption.setName("Foobar");

        try {
            TrackingOptions result = apiInstance.createTrackingOptions(accessToken, xeroTenantId, trackingCategoryID, trackingOption);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#createTrackingOptions");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID trackingCategoryID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a TrackingCategory
        TrackingOption trackingOption = { name: " Bar" }; // TrackingOption | 
        try {
            TrackingOptions result = apiInstance.createTrackingOptions(xeroTenantId, trackingCategoryID, trackingOption);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#createTrackingOptions");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *trackingCategoryID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a TrackingCategory (default to null)
TrackingOption *trackingOption = { name: " Bar" }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates options for a specific tracking category
[apiInstance createTrackingOptionsWith:xeroTenantId
    trackingCategoryID:trackingCategoryID
    trackingOption:trackingOption
              completionHandler: ^(TrackingOptions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const trackingCategoryID = '00000000-0000-0000-0000-000000000000';

const trackingOption: TrackingOption = { 
    name: "Foobar" }; 

try {
  const response = await xero.accountingApi.createTrackingOptions(xeroTenantId, trackingCategoryID, trackingOption);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class CreateTrackingOptionsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var trackingCategoryID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var trackingOption = new TrackingOption();
            trackingOption.Name = "Foobar";
            
            try {
                var result = await apiInstance.CreateTrackingOptionsAsync(accessToken, xeroTenantId, trackingCategoryID, trackingOption);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.CreateTrackingOptions: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$trackingCategoryID = "00000000-0000-0000-0000-000000000000";

$trackingOption = new XeroAPI\XeroPHP\Models\Accounting\TrackingOption;
$trackingOption->setName('Foobar');

try {
  $result = $apiInstance->createTrackingOptions($xeroTenantId, $trackingCategoryID, $trackingOption);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->createTrackingOptions: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $trackingCategoryID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a TrackingCategory
my $trackingOption = ::Object::TrackingOption->new(); # TrackingOption | 

eval { 
    my $result = $api_instance->createTrackingOptions(xeroTenantId => $xeroTenantId, trackingCategoryID => $trackingCategoryID, trackingOption => $trackingOption);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->createTrackingOptions: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_create_tracking_options():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    tracking_category_id = '00000000-0000-0000-0000-000000000000'

    trackingOption = TrackingOption(
        name = "Foobar")
    
    try:
        api_response = api_instance.create_tracking_options(xero_tenant_id, tracking_category_id, trackingOption)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->createTrackingOptions: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let trackingCategoryID = 00000000-0000-0000-0000-000000000000; // UUID
    let trackingOption = { name: " Bar" }; // TrackingOption

    let mut context = AccountingApi::Context::default();
    let result = client.createTrackingOptions(xeroTenantId, trackingCategoryID, trackingOption, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Path parameters
Name Description
TrackingCategoryID*
UUID (uuid)
Unique identifier for a TrackingCategory
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
trackingOption *
TrackingOption
TrackingOption object in body of request
Required

deleteAccount

Deletes a chart of accounts


/Accounts/{AccountID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Accounts/{AccountID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID accountID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Accounts result = apiInstance.deleteAccount(accessToken, xeroTenantId, accountID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#deleteAccount");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID accountID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Account object
        try {
            Accounts result = apiInstance.deleteAccount(xeroTenantId, accountID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#deleteAccount");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *accountID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Account object (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Deletes a chart of accounts
[apiInstance deleteAccountWith:xeroTenantId
    accountID:accountID
              completionHandler: ^(Accounts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const accountID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.deleteAccount(xeroTenantId, accountID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class DeleteAccountExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var accountID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.DeleteAccountAsync(accessToken, xeroTenantId, accountID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.DeleteAccount: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$accountID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->deleteAccount($xeroTenantId, $accountID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->deleteAccount: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $accountID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Account object

eval { 
    my $result = $api_instance->deleteAccount(xeroTenantId => $xeroTenantId, accountID => $accountID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->deleteAccount: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_delete_account():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    account_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.delete_account(xero_tenant_id, account_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deleteAccount: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let accountID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.deleteAccount(xeroTenantId, accountID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Path parameters
Name Description
AccountID*
UUID (uuid)
Unique identifier for Account object
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

deleteContactGroupContact

Deletes a specific contact from a contact group using a unique contact Id


/ContactGroups/{ContactGroupID}/Contacts/{ContactID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ContactGroups/{ContactGroupID}/Contacts/{ContactID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID contactGroupID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
             result = apiInstance.deleteContactGroupContact(accessToken, xeroTenantId, contactGroupID, contactID);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#deleteContactGroupContact");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactGroupID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact Group
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        try {
            apiInstance.deleteContactGroupContact(xeroTenantId, contactGroupID, contactID);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#deleteContactGroupContact");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactGroupID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact Group (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Deletes a specific contact from a contact group using a unique contact Id
[apiInstance deleteContactGroupContactWith:xeroTenantId
    contactGroupID:contactGroupID
    contactID:contactID
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactGroupID = '00000000-0000-0000-0000-000000000000';
const contactID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.deleteContactGroupContact(xeroTenantId, contactGroupID, contactID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class DeleteContactGroupContactExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactGroupID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var contactID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                await apiInstance.DeleteContactGroupContactAsync(accessToken, xeroTenantId, contactGroupID, contactID);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.DeleteContactGroupContact: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactGroupID = "00000000-0000-0000-0000-000000000000";
$contactID = "00000000-0000-0000-0000-000000000000";

try {
  $apiInstance->deleteContactGroupContact($xeroTenantId, $contactGroupID, $contactID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->deleteContactGroupContact: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactGroupID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact Group
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact

eval { 
    $api_instance->deleteContactGroupContact(xeroTenantId => $xeroTenantId, contactGroupID => $contactGroupID, contactID => $contactID);
};
if ($@) {
    warn "Exception when calling AccountingApi->deleteContactGroupContact: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_delete_contact_group_contact():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    contact_group_id = '00000000-0000-0000-0000-000000000000'
    contact_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_instance.delete_contact_group_contact(xero_tenant_id, contact_group_id, contact_id)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deleteContactGroupContact: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactGroupID = 00000000-0000-0000-0000-000000000000; // UUID
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.deleteContactGroupContact(xeroTenantId, contactGroupID, contactID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts Grant read-write access to contacts and contact groups

Parameters

Path parameters
Name Description
ContactGroupID*
UUID (uuid)
Unique identifier for a Contact Group
Required
ContactID*
UUID (uuid)
Unique identifier for a Contact
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

deleteContactGroupContacts

Deletes all contacts from a specific contact group


/ContactGroups/{ContactGroupID}/Contacts

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ContactGroups/{ContactGroupID}/Contacts"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID contactGroupID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
             result = apiInstance.deleteContactGroupContacts(accessToken, xeroTenantId, contactGroupID);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#deleteContactGroupContacts");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactGroupID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact Group
        try {
            apiInstance.deleteContactGroupContacts(xeroTenantId, contactGroupID);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#deleteContactGroupContacts");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactGroupID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact Group (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Deletes all contacts from a specific contact group
[apiInstance deleteContactGroupContactsWith:xeroTenantId
    contactGroupID:contactGroupID
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactGroupID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.deleteContactGroupContacts(xeroTenantId, contactGroupID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class DeleteContactGroupContactsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactGroupID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                await apiInstance.DeleteContactGroupContactsAsync(accessToken, xeroTenantId, contactGroupID);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.DeleteContactGroupContacts: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactGroupID = "00000000-0000-0000-0000-000000000000";

try {
  $apiInstance->deleteContactGroupContacts($xeroTenantId, $contactGroupID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->deleteContactGroupContacts: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactGroupID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact Group

eval { 
    $api_instance->deleteContactGroupContacts(xeroTenantId => $xeroTenantId, contactGroupID => $contactGroupID);
};
if ($@) {
    warn "Exception when calling AccountingApi->deleteContactGroupContacts: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_delete_contact_group_contacts():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    contact_group_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_instance.delete_contact_group_contacts(xero_tenant_id, contact_group_id)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deleteContactGroupContacts: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactGroupID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.deleteContactGroupContacts(xeroTenantId, contactGroupID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts Grant read-write access to contacts and contact groups

Parameters

Path parameters
Name Description
ContactGroupID*
UUID (uuid)
Unique identifier for a Contact Group
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

deleteItem

Deletes a specific item


/Items/{ItemID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Items/{ItemID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID itemID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
             result = apiInstance.deleteItem(accessToken, xeroTenantId, itemID);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#deleteItem");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID itemID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Item
        try {
            apiInstance.deleteItem(xeroTenantId, itemID);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#deleteItem");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *itemID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Item (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Deletes a specific item
[apiInstance deleteItemWith:xeroTenantId
    itemID:itemID
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const itemID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.deleteItem(xeroTenantId, itemID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class DeleteItemExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var itemID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                await apiInstance.DeleteItemAsync(accessToken, xeroTenantId, itemID);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.DeleteItem: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$itemID = "00000000-0000-0000-0000-000000000000";

try {
  $apiInstance->deleteItem($xeroTenantId, $itemID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->deleteItem: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $itemID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Item

eval { 
    $api_instance->deleteItem(xeroTenantId => $xeroTenantId, itemID => $itemID);
};
if ($@) {
    warn "Exception when calling AccountingApi->deleteItem: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_delete_item():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    item_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_instance.delete_item(xero_tenant_id, item_id)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deleteItem: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let itemID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.deleteItem(xeroTenantId, itemID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Path parameters
Name Description
ItemID*
UUID (uuid)
Unique identifier for an Item
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

deleteLinkedTransaction

Deletes a specific linked transactions (billable expenses)


/LinkedTransactions/{LinkedTransactionID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/LinkedTransactions/{LinkedTransactionID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID linkedTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
             result = apiInstance.deleteLinkedTransaction(accessToken, xeroTenantId, linkedTransactionID);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#deleteLinkedTransaction");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID linkedTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a LinkedTransaction
        try {
            apiInstance.deleteLinkedTransaction(xeroTenantId, linkedTransactionID);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#deleteLinkedTransaction");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *linkedTransactionID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a LinkedTransaction (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Deletes a specific linked transactions (billable expenses)
[apiInstance deleteLinkedTransactionWith:xeroTenantId
    linkedTransactionID:linkedTransactionID
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const linkedTransactionID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.deleteLinkedTransaction(xeroTenantId, linkedTransactionID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class DeleteLinkedTransactionExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var linkedTransactionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                await apiInstance.DeleteLinkedTransactionAsync(accessToken, xeroTenantId, linkedTransactionID);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.DeleteLinkedTransaction: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$linkedTransactionID = "00000000-0000-0000-0000-000000000000";

try {
  $apiInstance->deleteLinkedTransaction($xeroTenantId, $linkedTransactionID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->deleteLinkedTransaction: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $linkedTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a LinkedTransaction

eval { 
    $api_instance->deleteLinkedTransaction(xeroTenantId => $xeroTenantId, linkedTransactionID => $linkedTransactionID);
};
if ($@) {
    warn "Exception when calling AccountingApi->deleteLinkedTransaction: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_delete_linked_transaction():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    linked_transaction_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_instance.delete_linked_transaction(xero_tenant_id, linked_transaction_id)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deleteLinkedTransaction: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let linkedTransactionID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.deleteLinkedTransaction(xeroTenantId, linkedTransactionID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
LinkedTransactionID*
UUID (uuid)
Unique identifier for a LinkedTransaction
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

deletePayment

Updates a specific payment for invoices and credit notes


/Payments/{PaymentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Payments/{PaymentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID paymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        PaymentDelete paymentDelete = new PaymentDelete();
        paymentDelete.setStatus("DELETED");

        try {
            Payments result = apiInstance.deletePayment(accessToken, xeroTenantId, paymentID, paymentDelete);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#deletePayment");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID paymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Payment
        PaymentDelete paymentDelete = { "Payments":[ { "Status":"DELETED" } ] }; // PaymentDelete | 
        try {
            Payments result = apiInstance.deletePayment(xeroTenantId, paymentID, paymentDelete);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#deletePayment");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *paymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Payment (default to null)
PaymentDelete *paymentDelete = { "Payments":[ { "Status":"DELETED" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific payment for invoices and credit notes
[apiInstance deletePaymentWith:xeroTenantId
    paymentID:paymentID
    paymentDelete:paymentDelete
              completionHandler: ^(Payments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const paymentID = '00000000-0000-0000-0000-000000000000';

const paymentDelete: PaymentDelete = { 
    status: "DELETED" }; 

try {
  const response = await xero.accountingApi.deletePayment(xeroTenantId, paymentID, paymentDelete);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class DeletePaymentExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var paymentID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var paymentDelete = new PaymentDelete();
            paymentDelete.Status = "DELETED";
            
            try {
                var result = await apiInstance.DeletePaymentAsync(accessToken, xeroTenantId, paymentID, paymentDelete);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.DeletePayment: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$paymentID = "00000000-0000-0000-0000-000000000000";

$paymentDelete = new XeroAPI\XeroPHP\Models\Accounting\PaymentDelete;
$paymentDelete->setStatus('DELETED');

try {
  $result = $apiInstance->deletePayment($xeroTenantId, $paymentID, $paymentDelete);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->deletePayment: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $paymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Payment
my $paymentDelete = ::Object::PaymentDelete->new(); # PaymentDelete | 

eval { 
    my $result = $api_instance->deletePayment(xeroTenantId => $xeroTenantId, paymentID => $paymentID, paymentDelete => $paymentDelete);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->deletePayment: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_delete_payment():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    payment_id = '00000000-0000-0000-0000-000000000000'

    paymentDelete = PaymentDelete(
        status = "DELETED")
    
    try:
        api_response = api_instance.delete_payment(xero_tenant_id, payment_id, paymentDelete)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deletePayment: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let paymentID = 00000000-0000-0000-0000-000000000000; // UUID
    let paymentDelete = { "Payments":[ { "Status":"DELETED" } ] }; // PaymentDelete

    let mut context = AccountingApi::Context::default();
    let result = client.deletePayment(xeroTenantId, paymentID, paymentDelete, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
PaymentID*
UUID (uuid)
Unique identifier for a Payment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
paymentDelete *
PaymentDelete
Required

deleteTrackingCategory

Deletes a specific tracking category


/TrackingCategories/{TrackingCategoryID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/TrackingCategories/{TrackingCategoryID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID trackingCategoryID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            TrackingCategories result = apiInstance.deleteTrackingCategory(accessToken, xeroTenantId, trackingCategoryID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#deleteTrackingCategory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID trackingCategoryID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a TrackingCategory
        try {
            TrackingCategories result = apiInstance.deleteTrackingCategory(xeroTenantId, trackingCategoryID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#deleteTrackingCategory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *trackingCategoryID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a TrackingCategory (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Deletes a specific tracking category
[apiInstance deleteTrackingCategoryWith:xeroTenantId
    trackingCategoryID:trackingCategoryID
              completionHandler: ^(TrackingCategories output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const trackingCategoryID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.deleteTrackingCategory(xeroTenantId, trackingCategoryID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class DeleteTrackingCategoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var trackingCategoryID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.DeleteTrackingCategoryAsync(accessToken, xeroTenantId, trackingCategoryID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.DeleteTrackingCategory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$trackingCategoryID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->deleteTrackingCategory($xeroTenantId, $trackingCategoryID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->deleteTrackingCategory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $trackingCategoryID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a TrackingCategory

eval { 
    my $result = $api_instance->deleteTrackingCategory(xeroTenantId => $xeroTenantId, trackingCategoryID => $trackingCategoryID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->deleteTrackingCategory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_delete_tracking_category():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    tracking_category_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.delete_tracking_category(xero_tenant_id, tracking_category_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deleteTrackingCategory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let trackingCategoryID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.deleteTrackingCategory(xeroTenantId, trackingCategoryID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Path parameters
Name Description
TrackingCategoryID*
UUID (uuid)
Unique identifier for a TrackingCategory
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

deleteTrackingOptions

Deletes a specific option for a specific tracking category


/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID trackingCategoryID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID trackingOptionID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            TrackingOptions result = apiInstance.deleteTrackingOptions(accessToken, xeroTenantId, trackingCategoryID, trackingOptionID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#deleteTrackingOptions");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID trackingCategoryID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a TrackingCategory
        UUID trackingOptionID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Tracking Option
        try {
            TrackingOptions result = apiInstance.deleteTrackingOptions(xeroTenantId, trackingCategoryID, trackingOptionID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#deleteTrackingOptions");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *trackingCategoryID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a TrackingCategory (default to null)
UUID *trackingOptionID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Tracking Option (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Deletes a specific option for a specific tracking category
[apiInstance deleteTrackingOptionsWith:xeroTenantId
    trackingCategoryID:trackingCategoryID
    trackingOptionID:trackingOptionID
              completionHandler: ^(TrackingOptions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const trackingCategoryID = '00000000-0000-0000-0000-000000000000';
const trackingOptionID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.deleteTrackingOptions(xeroTenantId, trackingCategoryID, trackingOptionID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class DeleteTrackingOptionsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var trackingCategoryID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var trackingOptionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.DeleteTrackingOptionsAsync(accessToken, xeroTenantId, trackingCategoryID, trackingOptionID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.DeleteTrackingOptions: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$trackingCategoryID = "00000000-0000-0000-0000-000000000000";
$trackingOptionID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->deleteTrackingOptions($xeroTenantId, $trackingCategoryID, $trackingOptionID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->deleteTrackingOptions: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $trackingCategoryID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a TrackingCategory
my $trackingOptionID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Tracking Option

eval { 
    my $result = $api_instance->deleteTrackingOptions(xeroTenantId => $xeroTenantId, trackingCategoryID => $trackingCategoryID, trackingOptionID => $trackingOptionID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->deleteTrackingOptions: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_delete_tracking_options():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    tracking_category_id = '00000000-0000-0000-0000-000000000000'
    tracking_option_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.delete_tracking_options(xero_tenant_id, tracking_category_id, tracking_option_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->deleteTrackingOptions: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let trackingCategoryID = 00000000-0000-0000-0000-000000000000; // UUID
    let trackingOptionID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.deleteTrackingOptions(xeroTenantId, trackingCategoryID, trackingOptionID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Path parameters
Name Description
TrackingCategoryID*
UUID (uuid)
Unique identifier for a TrackingCategory
Required
TrackingOptionID*
UUID (uuid)
Unique identifier for a Tracking Option
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

emailInvoice

Sends a copy of a specific invoice to related contact via email


/Invoices/{InvoiceID}/Email

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}/Email"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID invoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        RequestEmpty requestEmpty = new RequestEmpty();

        try {
             result = apiInstance.emailInvoice(accessToken, xeroTenantId, invoiceID, requestEmpty);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#emailInvoice");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID invoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Invoice
        RequestEmpty requestEmpty = {}; // RequestEmpty | 
        try {
            apiInstance.emailInvoice(xeroTenantId, invoiceID, requestEmpty);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#emailInvoice");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *invoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Invoice (default to null)
RequestEmpty *requestEmpty = {}; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Sends a copy of a specific invoice to related contact via email
[apiInstance emailInvoiceWith:xeroTenantId
    invoiceID:invoiceID
    requestEmpty:requestEmpty
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const invoiceID = '00000000-0000-0000-0000-000000000000';

const requestEmpty: RequestEmpty = { };

try {
  const response = await xero.accountingApi.emailInvoice(xeroTenantId, invoiceID, requestEmpty);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class EmailInvoiceExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var invoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var requestEmpty = new RequestEmpty();
            
            try {
                await apiInstance.EmailInvoiceAsync(accessToken, xeroTenantId, invoiceID, requestEmpty);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.EmailInvoice: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$invoiceID = "00000000-0000-0000-0000-000000000000";

$requestEmpty = new XeroAPI\XeroPHP\Models\Accounting\RequestEmpty;

try {
  $apiInstance->emailInvoice($xeroTenantId, $invoiceID, $requestEmpty);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->emailInvoice: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Invoice
my $requestEmpty = ::Object::RequestEmpty->new(); # RequestEmpty | 

eval { 
    $api_instance->emailInvoice(xeroTenantId => $xeroTenantId, invoiceID => $invoiceID, requestEmpty => $requestEmpty);
};
if ($@) {
    warn "Exception when calling AccountingApi->emailInvoice: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_email_invoice():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    invoice_id = '00000000-0000-0000-0000-000000000000'

    requestEmpty = RequestEmpty()
    
    try:
        api_instance.email_invoice(xero_tenant_id, invoice_id, requestEmpty)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->emailInvoice: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let requestEmpty = {}; // RequestEmpty

    let mut context = AccountingApi::Context::default();
    let result = client.emailInvoice(xeroTenantId, invoiceID, requestEmpty, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
InvoiceID*
UUID (uuid)
Unique identifier for an Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
requestEmpty *
RequestEmpty
Required

getAccount

Retrieves a single chart of accounts by using a unique account Id


/Accounts/{AccountID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Accounts/{AccountID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID accountID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Accounts result = apiInstance.getAccount(accessToken, xeroTenantId, accountID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getAccount");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID accountID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Account object
        try {
            Accounts result = apiInstance.getAccount(xeroTenantId, accountID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getAccount");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *accountID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Account object (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a single chart of accounts by using a unique account Id
[apiInstance getAccountWith:xeroTenantId
    accountID:accountID
              completionHandler: ^(Accounts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const accountID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getAccount(xeroTenantId, accountID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetAccountExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var accountID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetAccountAsync(accessToken, xeroTenantId, accountID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetAccount: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$accountID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getAccount($xeroTenantId, $accountID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getAccount: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $accountID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Account object

eval { 
    my $result = $api_instance->getAccount(xeroTenantId => $xeroTenantId, accountID => $accountID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getAccount: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_account():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    account_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_account(xero_tenant_id, account_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getAccount: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let accountID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getAccount(xeroTenantId, accountID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Path parameters
Name Description
AccountID*
UUID (uuid)
Unique identifier for Account object
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getAccountAttachmentByFileName

Retrieves an attachment for a specific account by filename


/Accounts/{AccountID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Accounts/{AccountID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID accountID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        String contentType = 'image/jpg';

        try {
            ByteArrayInputStream result = apiInstance.getAccountAttachmentByFileName(accessToken, xeroTenantId, accountID, fileName, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getAccountAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID accountID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Account object
        String fileName = xero-dev.jpg; // String | Name of the attachment
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getAccountAttachmentByFileName(xeroTenantId, accountID, fileName, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getAccountAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *accountID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Account object (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves an attachment for a specific account by filename
[apiInstance getAccountAttachmentByFileNameWith:xeroTenantId
    accountID:accountID
    fileName:fileName
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const accountID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getAccountAttachmentByFileName(xeroTenantId, accountID, fileName, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetAccountAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var accountID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetAccountAttachmentByFileNameAsync(accessToken, xeroTenantId, accountID, fileName, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetAccountAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$accountID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getAccountAttachmentByFileName($xeroTenantId, $accountID, $fileName, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getAccountAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $accountID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Account object
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getAccountAttachmentByFileName(xeroTenantId => $xeroTenantId, accountID => $accountID, fileName => $fileName, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getAccountAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_account_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    account_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_account_attachment_by_file_name(xero_tenant_id, account_id, file_name, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getAccountAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let accountID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getAccountAttachmentByFileName(xeroTenantId, accountID, fileName, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
AccountID*
UUID (uuid)
Unique identifier for Account object
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getAccountAttachmentById

Retrieves a specific attachment from a specific account using a unique attachment Id


/Accounts/{AccountID}/Attachments/{AttachmentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Accounts/{AccountID}/Attachments/{AttachmentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID accountID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID attachmentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String contentType = 'image/jpg';

        try {
            ByteArrayInputStream result = apiInstance.getAccountAttachmentById(accessToken, xeroTenantId, accountID, attachmentID, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getAccountAttachmentById");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID accountID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Account object
        UUID attachmentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Attachment object
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getAccountAttachmentById(xeroTenantId, accountID, attachmentID, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getAccountAttachmentById");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *accountID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Account object (default to null)
UUID *attachmentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Attachment object (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific account using a unique attachment Id
[apiInstance getAccountAttachmentByIdWith:xeroTenantId
    accountID:accountID
    attachmentID:attachmentID
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const accountID = '00000000-0000-0000-0000-000000000000';
const attachmentID = '00000000-0000-0000-0000-000000000000';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getAccountAttachmentById(xeroTenantId, accountID, attachmentID, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetAccountAttachmentByIdExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var accountID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var attachmentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetAccountAttachmentByIdAsync(accessToken, xeroTenantId, accountID, attachmentID, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetAccountAttachmentById: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$accountID = "00000000-0000-0000-0000-000000000000";
$attachmentID = "00000000-0000-0000-0000-000000000000";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getAccountAttachmentById($xeroTenantId, $accountID, $attachmentID, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getAccountAttachmentById: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $accountID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Account object
my $attachmentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Attachment object
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getAccountAttachmentById(xeroTenantId => $xeroTenantId, accountID => $accountID, attachmentID => $attachmentID, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getAccountAttachmentById: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_account_attachment_by_id():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    account_id = '00000000-0000-0000-0000-000000000000'
    attachment_id = '00000000-0000-0000-0000-000000000000'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_account_attachment_by_id(xero_tenant_id, account_id, attachment_id, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getAccountAttachmentById: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let accountID = 00000000-0000-0000-0000-000000000000; // UUID
    let attachmentID = 00000000-0000-0000-0000-000000000000; // UUID
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getAccountAttachmentById(xeroTenantId, accountID, attachmentID, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
AccountID*
UUID (uuid)
Unique identifier for Account object
Required
AttachmentID*
UUID (uuid)
Unique identifier for Attachment object
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getAccountAttachments

Retrieves attachments for a specific accounts by using a unique account Id


/Accounts/{AccountID}/Attachments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Accounts/{AccountID}/Attachments"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID accountID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Attachments result = apiInstance.getAccountAttachments(accessToken, xeroTenantId, accountID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getAccountAttachments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID accountID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Account object
        try {
            Attachments result = apiInstance.getAccountAttachments(xeroTenantId, accountID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getAccountAttachments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *accountID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Account object (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves attachments for a specific accounts by using a unique account Id
[apiInstance getAccountAttachmentsWith:xeroTenantId
    accountID:accountID
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const accountID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getAccountAttachments(xeroTenantId, accountID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetAccountAttachmentsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var accountID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetAccountAttachmentsAsync(accessToken, xeroTenantId, accountID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetAccountAttachments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$accountID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getAccountAttachments($xeroTenantId, $accountID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getAccountAttachments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $accountID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Account object

eval { 
    my $result = $api_instance->getAccountAttachments(xeroTenantId => $xeroTenantId, accountID => $accountID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getAccountAttachments: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_account_attachments():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    account_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_account_attachments(xero_tenant_id, account_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getAccountAttachments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let accountID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getAccountAttachments(xeroTenantId, accountID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
AccountID*
UUID (uuid)
Unique identifier for Account object
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getAccounts

Retrieves the full chart of accounts


/Accounts

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Accounts?where=Status=="ACTIVE" AND Type=="BANK"&order=Name ASC"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';

        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = 'Status=="ACTIVE" AND Type=="BANK"';
        String order = 'Name ASC';

        try {
            Accounts result = apiInstance.getAccounts(accessToken, xeroTenantId, ifModifiedSince, where, order);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getAccounts");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = Status=="ACTIVE" AND Type=="BANK"; // String | Filter by an any element
        String order = Name ASC; // String | Order by an any element
        try {
            Accounts result = apiInstance.getAccounts(xeroTenantId, ifModifiedSince, where, order);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getAccounts");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = Status=="ACTIVE" AND Type=="BANK"; // Filter by an any element (optional) (default to null)
String *order = Name ASC; // Order by an any element (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves the full chart of accounts
[apiInstance getAccountsWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
              completionHandler: ^(Accounts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="ACTIVE" AND Type=="BANK"';
const order = 'Name ASC';

try {
  const response = await xero.accountingApi.getAccounts(xeroTenantId, ifModifiedSince, where, order);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetAccountsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var ifModifiedSince = DateTime.Parse("2020-02-06T12:17:43.202-08:00");
            var where = "Status==\"ACTIVE\"";
            var order = "Name ASC";
            
            try {
                var result = await apiInstance.GetAccountsAsync(accessToken, xeroTenantId, ifModifiedSince, where, order);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetAccounts: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\Account::STATUS_ACTIVE . '"";
$order = "Name ASC";

try {
  $result = $apiInstance->getAccounts($xeroTenantId, $ifModifiedSince, $where, $order);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getAccounts: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = Status=="ACTIVE" AND Type=="BANK"; # String | Filter by an any element
my $order = Name ASC; # String | Order by an any element

eval { 
    my $result = $api_instance->getAccounts(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getAccounts: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_accounts():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    if_modified_since = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="ACTIVE" AND Type=="BANK"'
    order = 'Name ASC'
    
    try:
        api_response = api_instance.get_accounts(xero_tenant_id, if_modified_since, where, order)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getAccounts: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = Status=="ACTIVE" AND Type=="BANK"; // String
    let order = Name ASC; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getAccounts(xeroTenantId, ifModifiedSince, where, order, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element

getBankTransaction

Retrieves a single spent or received money transaction by using a unique bank transaction Id


/BankTransactions/{BankTransactionID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransactions/{BankTransactionID}?unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID bankTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Integer unitdp = 4;

        try {
            BankTransactions result = apiInstance.getBankTransaction(accessToken, xeroTenantId, bankTransactionID, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransaction");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transaction
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            BankTransactions result = apiInstance.getBankTransaction(xeroTenantId, bankTransactionID, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransaction");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransactionID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transaction (default to null)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a single spent or received money transaction by using a unique bank transaction Id
[apiInstance getBankTransactionWith:xeroTenantId
    bankTransactionID:bankTransactionID
    unitdp:unitdp
              completionHandler: ^(BankTransactions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransactionID = '00000000-0000-0000-0000-000000000000';
const unitdp = 4;

try {
  const response = await xero.accountingApi.getBankTransaction(xeroTenantId, bankTransactionID,  unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBankTransactionExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransactionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var unitdp = 4;
            
            try {
                var result = await apiInstance.GetBankTransactionAsync(accessToken, xeroTenantId, bankTransactionID, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBankTransaction: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransactionID = "00000000-0000-0000-0000-000000000000";
$unitdp = 4;

try {
  $result = $apiInstance->getBankTransaction($xeroTenantId, $bankTransactionID, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBankTransaction: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transaction
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->getBankTransaction(xeroTenantId => $xeroTenantId, bankTransactionID => $bankTransactionID, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBankTransaction: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_bank_transaction():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transaction_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_bank_transaction(xero_tenant_id, bank_transaction_id, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransaction: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getBankTransaction(xeroTenantId, bankTransactionID, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
BankTransactionID*
UUID (uuid)
Xero generated unique identifier for a bank transaction
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

getBankTransactionAttachmentByFileName

Retrieves a specific attachment from a specific bank transaction by filename


/BankTransactions/{BankTransactionID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransactions/{BankTransactionID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID bankTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        String contentType = 'image/jpg';

        try {
            ByteArrayInputStream result = apiInstance.getBankTransactionAttachmentByFileName(accessToken, xeroTenantId, bankTransactionID, fileName, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransactionAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transaction
        String fileName = xero-dev.jpg; // String | Name of the attachment
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransactionAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransactionID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transaction (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific bank transaction by filename
[apiInstance getBankTransactionAttachmentByFileNameWith:xeroTenantId
    bankTransactionID:bankTransactionID
    fileName:fileName
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransactionID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBankTransactionAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransactionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetBankTransactionAttachmentByFileNameAsync(accessToken, xeroTenantId, bankTransactionID, fileName, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBankTransactionAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransactionID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getBankTransactionAttachmentByFileName($xeroTenantId, $bankTransactionID, $fileName, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBankTransactionAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transaction
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getBankTransactionAttachmentByFileName(xeroTenantId => $xeroTenantId, bankTransactionID => $bankTransactionID, fileName => $fileName, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBankTransactionAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_bank_transaction_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transaction_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_bank_transaction_attachment_by_file_name(xero_tenant_id, bank_transaction_id, file_name, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransactionAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
BankTransactionID*
UUID (uuid)
Xero generated unique identifier for a bank transaction
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getBankTransactionAttachmentById

Retrieves specific attachments from a specific BankTransaction using a unique attachment Id


/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransactions/{BankTransactionID}/Attachments/{AttachmentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID bankTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID attachmentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String contentType = 'image/jpg';

        try {
            ByteArrayInputStream result = apiInstance.getBankTransactionAttachmentById(accessToken, xeroTenantId, bankTransactionID, attachmentID, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransactionAttachmentById");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transaction
        UUID attachmentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Attachment object
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getBankTransactionAttachmentById(xeroTenantId, bankTransactionID, attachmentID, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransactionAttachmentById");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransactionID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transaction (default to null)
UUID *attachmentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Attachment object (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves specific attachments from a specific BankTransaction using a unique attachment Id
[apiInstance getBankTransactionAttachmentByIdWith:xeroTenantId
    bankTransactionID:bankTransactionID
    attachmentID:attachmentID
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransactionID = '00000000-0000-0000-0000-000000000000';
const attachmentID = '00000000-0000-0000-0000-000000000000';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getBankTransactionAttachmentById(xeroTenantId, bankTransactionID, attachmentID, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBankTransactionAttachmentByIdExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransactionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var attachmentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetBankTransactionAttachmentByIdAsync(accessToken, xeroTenantId, bankTransactionID, attachmentID, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBankTransactionAttachmentById: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransactionID = "00000000-0000-0000-0000-000000000000";
$attachmentID = "00000000-0000-0000-0000-000000000000";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getBankTransactionAttachmentById($xeroTenantId, $bankTransactionID, $attachmentID, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBankTransactionAttachmentById: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transaction
my $attachmentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Attachment object
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getBankTransactionAttachmentById(xeroTenantId => $xeroTenantId, bankTransactionID => $bankTransactionID, attachmentID => $attachmentID, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBankTransactionAttachmentById: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_bank_transaction_attachment_by_id():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transaction_id = '00000000-0000-0000-0000-000000000000'
    attachment_id = '00000000-0000-0000-0000-000000000000'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_bank_transaction_attachment_by_id(xero_tenant_id, bank_transaction_id, attachment_id, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransactionAttachmentById: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID
    let attachmentID = 00000000-0000-0000-0000-000000000000; // UUID
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getBankTransactionAttachmentById(xeroTenantId, bankTransactionID, attachmentID, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
BankTransactionID*
UUID (uuid)
Xero generated unique identifier for a bank transaction
Required
AttachmentID*
UUID (uuid)
Unique identifier for Attachment object
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getBankTransactionAttachments

Retrieves any attachments from a specific bank transactions


/BankTransactions/{BankTransactionID}/Attachments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransactions/{BankTransactionID}/Attachments"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID bankTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Attachments result = apiInstance.getBankTransactionAttachments(accessToken, xeroTenantId, bankTransactionID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransactionAttachments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transaction
        try {
            Attachments result = apiInstance.getBankTransactionAttachments(xeroTenantId, bankTransactionID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransactionAttachments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransactionID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transaction (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves any attachments from a specific bank transactions
[apiInstance getBankTransactionAttachmentsWith:xeroTenantId
    bankTransactionID:bankTransactionID
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransactionID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getBankTransactionAttachments(xeroTenantId, bankTransactionID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBankTransactionAttachmentsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransactionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetBankTransactionAttachmentsAsync(accessToken, xeroTenantId, bankTransactionID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBankTransactionAttachments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransactionID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getBankTransactionAttachments($xeroTenantId, $bankTransactionID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBankTransactionAttachments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transaction

eval { 
    my $result = $api_instance->getBankTransactionAttachments(xeroTenantId => $xeroTenantId, bankTransactionID => $bankTransactionID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBankTransactionAttachments: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_bank_transaction_attachments():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transaction_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_bank_transaction_attachments(xero_tenant_id, bank_transaction_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransactionAttachments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getBankTransactionAttachments(xeroTenantId, bankTransactionID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
BankTransactionID*
UUID (uuid)
Xero generated unique identifier for a bank transaction
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getBankTransactions

Retrieves any spent or received money transactions


/BankTransactions

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransactions?where=Status=="AUTHORISED"&order=Type ASC&page=1&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';

        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = 'Status=="AUTHORISED"';
        String order = 'Type ASC';
        Integer page = 1;
        Integer unitdp = 4;

        try {
            BankTransactions result = apiInstance.getBankTransactions(accessToken, xeroTenantId, ifModifiedSince, where, order, page, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransactions");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = Status=="AUTHORISED"; // String | Filter by an any element
        String order = Type ASC; // String | Order by an any element
        Integer page = 1; // Integer | Up to 100 bank transactions will be returned in a single API call with line items details
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            BankTransactions result = apiInstance.getBankTransactions(xeroTenantId, ifModifiedSince, where, order, page, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransactions");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = Status=="AUTHORISED"; // Filter by an any element (optional) (default to null)
String *order = Type ASC; // Order by an any element (optional) (default to null)
Integer *page = 1; // Up to 100 bank transactions will be returned in a single API call with line items details (optional) (default to null)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves any spent or received money transactions
[apiInstance getBankTransactionsWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
    page:page
    unitdp:unitdp
              completionHandler: ^(BankTransactions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="AUTHORISED"';
const order = 'Type ASC';
const page = 1;
const unitdp = 4;

try {
  const response = await xero.accountingApi.getBankTransactions(xeroTenantId, ifModifiedSince, where, order, page, unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBankTransactionsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var ifModifiedSince = DateTime.Parse("2020-02-06T12:17:43.202-08:00");
            var where = "Status==\"AUTHORISED\"";
            var order = "Type ASC";
            var page = 1;
            var unitdp = 4;
            
            try {
                var result = await apiInstance.GetBankTransactionsAsync(accessToken, xeroTenantId, ifModifiedSince, where, order, page, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBankTransactions: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "Status=="' . XeroAPI\XeroPHP\Models\Accounting\BankTransaction::STATUS_AUTHORISED . '"";
$order = "Type ASC";
$page = 1;
$unitdp = 4;

try {
  $result = $apiInstance->getBankTransactions($xeroTenantId, $ifModifiedSince, $where, $order, $page, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBankTransactions: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = Status=="AUTHORISED"; # String | Filter by an any element
my $order = Type ASC; # String | Order by an any element
my $page = 1; # Integer | Up to 100 bank transactions will be returned in a single API call with line items details
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->getBankTransactions(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order, page => $page, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBankTransactions: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_bank_transactions():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    if_modified_since = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="AUTHORISED"'
    order = 'Type ASC'
    
    try:
        api_response = api_instance.get_bank_transactions(xero_tenant_id, if_modified_since, where, order, page, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransactions: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = Status=="AUTHORISED"; // String
    let order = Type ASC; // String
    let page = 1; // Integer
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getBankTransactions(xeroTenantId, ifModifiedSince, where, order, page, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element
page
Integer
Up to 100 bank transactions will be returned in a single API call with line items details
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

getBankTransactionsHistory

Retrieves history from a specific bank transaction using a unique bank transaction Id


/BankTransactions/{BankTransactionID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransactions/{BankTransactionID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID bankTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getBankTransactionsHistory(accessToken, xeroTenantId, bankTransactionID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransactionsHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transaction
        try {
            HistoryRecords result = apiInstance.getBankTransactionsHistory(xeroTenantId, bankTransactionID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransactionsHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransactionID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transaction (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history from a specific bank transaction using a unique bank transaction Id
[apiInstance getBankTransactionsHistoryWith:xeroTenantId
    bankTransactionID:bankTransactionID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransactionID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getBankTransactionsHistory(xeroTenantId, bankTransactionID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBankTransactionsHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransactionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetBankTransactionsHistoryAsync(accessToken, xeroTenantId, bankTransactionID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBankTransactionsHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransactionID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getBankTransactionsHistory($xeroTenantId, $bankTransactionID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBankTransactionsHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transaction

eval { 
    my $result = $api_instance->getBankTransactionsHistory(xeroTenantId => $xeroTenantId, bankTransactionID => $bankTransactionID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBankTransactionsHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_bank_transactions_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transaction_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_bank_transactions_history(xero_tenant_id, bank_transaction_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransactionsHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getBankTransactionsHistory(xeroTenantId, bankTransactionID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
BankTransactionID*
UUID (uuid)
Xero generated unique identifier for a bank transaction
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getBankTransfer

Retrieves specific bank transfers by using a unique bank transfer Id


/BankTransfers/{BankTransferID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransfers/{BankTransferID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID bankTransferID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            BankTransfers result = apiInstance.getBankTransfer(accessToken, xeroTenantId, bankTransferID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransfer");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transfer
        try {
            BankTransfers result = apiInstance.getBankTransfer(xeroTenantId, bankTransferID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransfer");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransferID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transfer (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves specific bank transfers by using a unique bank transfer Id
[apiInstance getBankTransferWith:xeroTenantId
    bankTransferID:bankTransferID
              completionHandler: ^(BankTransfers output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransferID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getBankTransfer(xeroTenantId, bankTransferID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBankTransferExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransferID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetBankTransferAsync(accessToken, xeroTenantId, bankTransferID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBankTransfer: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransferID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getBankTransfer($xeroTenantId, $bankTransferID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBankTransfer: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransferID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transfer

eval { 
    my $result = $api_instance->getBankTransfer(xeroTenantId => $xeroTenantId, bankTransferID => $bankTransferID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBankTransfer: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_bank_transfer():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transfer_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_bank_transfer(xero_tenant_id, bank_transfer_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransfer: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getBankTransfer(xeroTenantId, bankTransferID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
BankTransferID*
UUID (uuid)
Xero generated unique identifier for a bank transfer
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getBankTransferAttachmentByFileName

Retrieves a specific attachment on a specific bank transfer by file name


/BankTransfers/{BankTransferID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransfers/{BankTransferID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID bankTransferID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        String contentType = 'image/jpg';

        try {
            ByteArrayInputStream result = apiInstance.getBankTransferAttachmentByFileName(accessToken, xeroTenantId, bankTransferID, fileName, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransferAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transfer
        String fileName = xero-dev.jpg; // String | Name of the attachment
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getBankTransferAttachmentByFileName(xeroTenantId, bankTransferID, fileName, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransferAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransferID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transfer (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment on a specific bank transfer by file name
[apiInstance getBankTransferAttachmentByFileNameWith:xeroTenantId
    bankTransferID:bankTransferID
    fileName:fileName
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransferID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getBankTransferAttachmentByFileName(xeroTenantId, bankTransferID, fileName, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBankTransferAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransferID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetBankTransferAttachmentByFileNameAsync(accessToken, xeroTenantId, bankTransferID, fileName, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBankTransferAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransferID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getBankTransferAttachmentByFileName($xeroTenantId, $bankTransferID, $fileName, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBankTransferAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransferID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transfer
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getBankTransferAttachmentByFileName(xeroTenantId => $xeroTenantId, bankTransferID => $bankTransferID, fileName => $fileName, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBankTransferAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_bank_transfer_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transfer_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_bank_transfer_attachment_by_file_name(xero_tenant_id, bank_transfer_id, file_name, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransferAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getBankTransferAttachmentByFileName(xeroTenantId, bankTransferID, fileName, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
BankTransferID*
UUID (uuid)
Xero generated unique identifier for a bank transfer
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getBankTransferAttachmentById

Retrieves a specific attachment from a specific bank transfer using a unique attachment ID


/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransfers/{BankTransferID}/Attachments/{AttachmentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID bankTransferID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID attachmentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String contentType = 'image/jpg';

        try {
            ByteArrayInputStream result = apiInstance.getBankTransferAttachmentById(accessToken, xeroTenantId, bankTransferID, attachmentID, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransferAttachmentById");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transfer
        UUID attachmentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Attachment object
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getBankTransferAttachmentById(xeroTenantId, bankTransferID, attachmentID, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransferAttachmentById");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransferID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transfer (default to null)
UUID *attachmentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Attachment object (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific bank transfer using a unique attachment ID
[apiInstance getBankTransferAttachmentByIdWith:xeroTenantId
    bankTransferID:bankTransferID
    attachmentID:attachmentID
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransferID = '00000000-0000-0000-0000-000000000000';
const attachmentID = '00000000-0000-0000-0000-000000000000';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getBankTransferAttachmentById(xeroTenantId, bankTransferID, attachmentID, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBankTransferAttachmentByIdExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransferID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var attachmentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetBankTransferAttachmentByIdAsync(accessToken, xeroTenantId, bankTransferID, attachmentID, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBankTransferAttachmentById: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransferID = "00000000-0000-0000-0000-000000000000";
$attachmentID = "00000000-0000-0000-0000-000000000000";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getBankTransferAttachmentById($xeroTenantId, $bankTransferID, $attachmentID, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBankTransferAttachmentById: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransferID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transfer
my $attachmentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Attachment object
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getBankTransferAttachmentById(xeroTenantId => $xeroTenantId, bankTransferID => $bankTransferID, attachmentID => $attachmentID, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBankTransferAttachmentById: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_bank_transfer_attachment_by_id():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transfer_id = '00000000-0000-0000-0000-000000000000'
    attachment_id = '00000000-0000-0000-0000-000000000000'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_bank_transfer_attachment_by_id(xero_tenant_id, bank_transfer_id, attachment_id, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransferAttachmentById: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID
    let attachmentID = 00000000-0000-0000-0000-000000000000; // UUID
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getBankTransferAttachmentById(xeroTenantId, bankTransferID, attachmentID, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
BankTransferID*
UUID (uuid)
Xero generated unique identifier for a bank transfer
Required
AttachmentID*
UUID (uuid)
Unique identifier for Attachment object
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getBankTransferAttachments

Retrieves attachments from a specific bank transfer


/BankTransfers/{BankTransferID}/Attachments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransfers/{BankTransferID}/Attachments"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID bankTransferID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Attachments result = apiInstance.getBankTransferAttachments(accessToken, xeroTenantId, bankTransferID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransferAttachments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transfer
        try {
            Attachments result = apiInstance.getBankTransferAttachments(xeroTenantId, bankTransferID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransferAttachments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransferID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transfer (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves attachments from a specific bank transfer
[apiInstance getBankTransferAttachmentsWith:xeroTenantId
    bankTransferID:bankTransferID
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransferID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getBankTransferAttachments(xeroTenantId, bankTransferID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBankTransferAttachmentsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransferID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetBankTransferAttachmentsAsync(accessToken, xeroTenantId, bankTransferID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBankTransferAttachments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransferID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getBankTransferAttachments($xeroTenantId, $bankTransferID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBankTransferAttachments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransferID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transfer

eval { 
    my $result = $api_instance->getBankTransferAttachments(xeroTenantId => $xeroTenantId, bankTransferID => $bankTransferID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBankTransferAttachments: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_bank_transfer_attachments():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transfer_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_bank_transfer_attachments(xero_tenant_id, bank_transfer_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransferAttachments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getBankTransferAttachments(xeroTenantId, bankTransferID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
BankTransferID*
UUID (uuid)
Xero generated unique identifier for a bank transfer
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getBankTransferHistory

Retrieves history from a specific bank transfer using a unique bank transfer Id


/BankTransfers/{BankTransferID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransfers/{BankTransferID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID bankTransferID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getBankTransferHistory(accessToken, xeroTenantId, bankTransferID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransferHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transfer
        try {
            HistoryRecords result = apiInstance.getBankTransferHistory(xeroTenantId, bankTransferID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransferHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransferID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transfer (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history from a specific bank transfer using a unique bank transfer Id
[apiInstance getBankTransferHistoryWith:xeroTenantId
    bankTransferID:bankTransferID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransferID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getBankTransferHistory(xeroTenantId, bankTransferID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBankTransferHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransferID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetBankTransferHistoryAsync(accessToken, xeroTenantId, bankTransferID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBankTransferHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransferID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getBankTransferHistory($xeroTenantId, $bankTransferID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBankTransferHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransferID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transfer

eval { 
    my $result = $api_instance->getBankTransferHistory(xeroTenantId => $xeroTenantId, bankTransferID => $bankTransferID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBankTransferHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_bank_transfer_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transfer_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_bank_transfer_history(xero_tenant_id, bank_transfer_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransferHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getBankTransferHistory(xeroTenantId, bankTransferID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
BankTransferID*
UUID (uuid)
Xero generated unique identifier for a bank transfer
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getBankTransfers

Retrieves all bank transfers


/BankTransfers

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransfers?where=HasAttachments==true&order=Amount ASC"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';

        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = 'HasAttachments==true';
        String order = 'Amount ASC';

        try {
            BankTransfers result = apiInstance.getBankTransfers(accessToken, xeroTenantId, ifModifiedSince, where, order);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransfers");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = HasAttachments==true; // String | Filter by an any element
        String order = Amount ASC; // String | Order by an any element
        try {
            BankTransfers result = apiInstance.getBankTransfers(xeroTenantId, ifModifiedSince, where, order);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBankTransfers");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = HasAttachments==true; // Filter by an any element (optional) (default to null)
String *order = Amount ASC; // Order by an any element (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves all bank transfers
[apiInstance getBankTransfersWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
              completionHandler: ^(BankTransfers output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'HasAttachments==true';
const order = 'Amount ASC';

try {
  const response = await xero.accountingApi.getBankTransfers(xeroTenantId, ifModifiedSince, where, order);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBankTransfersExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var ifModifiedSince = DateTime.Parse("2020-02-06T12:17:43.202-08:00");
            var where = "HasAttachments==true";
            var order = "Amount ASC";
            
            try {
                var result = await apiInstance.GetBankTransfersAsync(accessToken, xeroTenantId, ifModifiedSince, where, order);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBankTransfers: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "HasAttachments==true";
$order = "Amount ASC";

try {
  $result = $apiInstance->getBankTransfers($xeroTenantId, $ifModifiedSince, $where, $order);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBankTransfers: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = HasAttachments==true; # String | Filter by an any element
my $order = Amount ASC; # String | Order by an any element

eval { 
    my $result = $api_instance->getBankTransfers(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBankTransfers: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_bank_transfers():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    if_modified_since = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'HasAttachments==true'
    order = 'Amount ASC'
    
    try:
        api_response = api_instance.get_bank_transfers(xero_tenant_id, if_modified_since, where, order)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBankTransfers: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = HasAttachments==true; // String
    let order = Amount ASC; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getBankTransfers(xeroTenantId, ifModifiedSince, where, order, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element

getBatchPaymentHistory

Retrieves history from a specific batch payment


/BatchPayments/{BatchPaymentID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BatchPayments/{BatchPaymentID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID batchPaymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getBatchPaymentHistory(accessToken, xeroTenantId, batchPaymentID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBatchPaymentHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID batchPaymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for BatchPayment
        try {
            HistoryRecords result = apiInstance.getBatchPaymentHistory(xeroTenantId, batchPaymentID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBatchPaymentHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *batchPaymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for BatchPayment (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history from a specific batch payment
[apiInstance getBatchPaymentHistoryWith:xeroTenantId
    batchPaymentID:batchPaymentID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const batchPaymentID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getBatchPaymentHistory(xeroTenantId, batchPaymentID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBatchPaymentHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var batchPaymentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetBatchPaymentHistoryAsync(accessToken, xeroTenantId, batchPaymentID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBatchPaymentHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$batchPaymentID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getBatchPaymentHistory($xeroTenantId, $batchPaymentID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBatchPaymentHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $batchPaymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for BatchPayment

eval { 
    my $result = $api_instance->getBatchPaymentHistory(xeroTenantId => $xeroTenantId, batchPaymentID => $batchPaymentID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBatchPaymentHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_batch_payment_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    batch_payment_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_batch_payment_history(xero_tenant_id, batch_payment_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBatchPaymentHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let batchPaymentID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getBatchPaymentHistory(xeroTenantId, batchPaymentID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
BatchPaymentID*
UUID (uuid)
Unique identifier for BatchPayment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getBatchPayments

Retrieves either one or many batch payments for invoices


/BatchPayments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BatchPayments?where=Status=="AUTHORISED"&order=Date ASC"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';

        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = 'Status=="AUTHORISED"';
        String order = 'Date ASC';

        try {
            BatchPayments result = apiInstance.getBatchPayments(accessToken, xeroTenantId, ifModifiedSince, where, order);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBatchPayments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = Status=="AUTHORISED"; // String | Filter by an any element
        String order = Date ASC; // String | Order by an any element
        try {
            BatchPayments result = apiInstance.getBatchPayments(xeroTenantId, ifModifiedSince, where, order);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBatchPayments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = Status=="AUTHORISED"; // Filter by an any element (optional) (default to null)
String *order = Date ASC; // Order by an any element (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves either one or many batch payments for invoices
[apiInstance getBatchPaymentsWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
              completionHandler: ^(BatchPayments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="AUTHORISED"';
const order = 'Date ASC';

try {
  const response = await xero.accountingApi.getBatchPayments(xeroTenantId, ifModifiedSince, where, order);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBatchPaymentsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var ifModifiedSince = DateTime.Parse("2020-02-06T12:17:43.202-08:00");
            var where = "Status==\"AUTHORISED\"";
            var order = "Date ASC";
            
            try {
                var result = await apiInstance.GetBatchPaymentsAsync(accessToken, xeroTenantId, ifModifiedSince, where, order);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBatchPayments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "Status=="' . XeroAPI\XeroPHP\Models\Accounting\BatchPayment::STATUS_AUTHORISED . '"";
$order = "Date ASC";

try {
  $result = $apiInstance->getBatchPayments($xeroTenantId, $ifModifiedSince, $where, $order);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBatchPayments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = Status=="AUTHORISED"; # String | Filter by an any element
my $order = Date ASC; # String | Order by an any element

eval { 
    my $result = $api_instance->getBatchPayments(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBatchPayments: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_batch_payments():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    if_modified_since = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="AUTHORISED"'
    order = 'Date ASC'
    
    try:
        api_response = api_instance.get_batch_payments(xero_tenant_id, if_modified_since, where, order)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBatchPayments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = Status=="AUTHORISED"; // String
    let order = Date ASC; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getBatchPayments(xeroTenantId, ifModifiedSince, where, order, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element

getBrandingTheme

Retrieves a specific branding theme using a unique branding theme Id


/BrandingThemes/{BrandingThemeID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BrandingThemes/{BrandingThemeID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID brandingThemeID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            BrandingThemes result = apiInstance.getBrandingTheme(accessToken, xeroTenantId, brandingThemeID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBrandingTheme");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID brandingThemeID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Branding Theme
        try {
            BrandingThemes result = apiInstance.getBrandingTheme(xeroTenantId, brandingThemeID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBrandingTheme");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *brandingThemeID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Branding Theme (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific branding theme using a unique branding theme Id
[apiInstance getBrandingThemeWith:xeroTenantId
    brandingThemeID:brandingThemeID
              completionHandler: ^(BrandingThemes output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const brandingThemeID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getBrandingTheme(xeroTenantId, brandingThemeID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBrandingThemeExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var brandingThemeID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetBrandingThemeAsync(accessToken, xeroTenantId, brandingThemeID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBrandingTheme: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$brandingThemeID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getBrandingTheme($xeroTenantId, $brandingThemeID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBrandingTheme: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $brandingThemeID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Branding Theme

eval { 
    my $result = $api_instance->getBrandingTheme(xeroTenantId => $xeroTenantId, brandingThemeID => $brandingThemeID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBrandingTheme: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_branding_theme():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    branding_theme_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_branding_theme(xero_tenant_id, branding_theme_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBrandingTheme: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let brandingThemeID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getBrandingTheme(xeroTenantId, brandingThemeID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Path parameters
Name Description
BrandingThemeID*
UUID (uuid)
Unique identifier for a Branding Theme
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getBrandingThemePaymentServices

Retrieves the payment services for a specific branding theme


/BrandingThemes/{BrandingThemeID}/PaymentServices

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BrandingThemes/{BrandingThemeID}/PaymentServices"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID brandingThemeID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            PaymentServices result = apiInstance.getBrandingThemePaymentServices(accessToken, xeroTenantId, brandingThemeID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBrandingThemePaymentServices");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID brandingThemeID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Branding Theme
        try {
            PaymentServices result = apiInstance.getBrandingThemePaymentServices(xeroTenantId, brandingThemeID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBrandingThemePaymentServices");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *brandingThemeID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Branding Theme (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves the payment services for a specific branding theme
[apiInstance getBrandingThemePaymentServicesWith:xeroTenantId
    brandingThemeID:brandingThemeID
              completionHandler: ^(PaymentServices output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const brandingThemeID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getBrandingThemePaymentServices(xeroTenantId, brandingThemeID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBrandingThemePaymentServicesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var brandingThemeID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetBrandingThemePaymentServicesAsync(accessToken, xeroTenantId, brandingThemeID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBrandingThemePaymentServices: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$brandingThemeID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getBrandingThemePaymentServices($xeroTenantId, $brandingThemeID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBrandingThemePaymentServices: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $brandingThemeID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Branding Theme

eval { 
    my $result = $api_instance->getBrandingThemePaymentServices(xeroTenantId => $xeroTenantId, brandingThemeID => $brandingThemeID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBrandingThemePaymentServices: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_branding_theme_payment_services():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    branding_theme_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_branding_theme_payment_services(xero_tenant_id, branding_theme_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBrandingThemePaymentServices: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let brandingThemeID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getBrandingThemePaymentServices(xeroTenantId, brandingThemeID, &context).wait();
    println!("{:?}", result);

}

Scopes

paymentservices Grant read-write access to payment services

Parameters

Path parameters
Name Description
BrandingThemeID*
UUID (uuid)
Unique identifier for a Branding Theme
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getBrandingThemes

Retrieves all the branding themes


/BrandingThemes

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BrandingThemes"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';

        try {
            BrandingThemes result = apiInstance.getBrandingThemes(accessToken, xeroTenantId);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getBrandingThemes");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        try {
            BrandingThemes result = apiInstance.getBrandingThemes(xeroTenantId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getBrandingThemes");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves all the branding themes
[apiInstance getBrandingThemesWith:xeroTenantId
              completionHandler: ^(BrandingThemes output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';

try {
  const response = await xero.accountingApi.getBrandingThemes(xeroTenantId);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetBrandingThemesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            
            try {
                var result = await apiInstance.GetBrandingThemesAsync(accessToken, xeroTenantId);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetBrandingThemes: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

try {
  $result = $apiInstance->getBrandingThemes($xeroTenantId);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getBrandingThemes: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant

eval { 
    my $result = $api_instance->getBrandingThemes(xeroTenantId => $xeroTenantId);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getBrandingThemes: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_branding_themes():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    
    try:
        api_response = api_instance.get_branding_themes(xero_tenant_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getBrandingThemes: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getBrandingThemes(xeroTenantId, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getContact

Retrieves a specific contacts in a Xero organisation using a unique contact Id


/Contacts/{ContactID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts/{ContactID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Contacts result = apiInstance.getContact(accessToken, xeroTenantId, contactID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getContact");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        try {
            Contacts result = apiInstance.getContact(xeroTenantId, contactID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getContact");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific contacts in a Xero organisation using a unique contact Id
[apiInstance getContactWith:xeroTenantId
    contactID:contactID
              completionHandler: ^(Contacts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getContact(xeroTenantId, contactID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetContactExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetContactAsync(accessToken, xeroTenantId, contactID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetContact: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getContact($xeroTenantId, $contactID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getContact: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact

eval { 
    my $result = $api_instance->getContact(xeroTenantId => $xeroTenantId, contactID => $contactID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getContact: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_contact():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    contact_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_contact(xero_tenant_id, contact_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getContact: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getContact(xeroTenantId, contactID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts.read Grant read-only access to contacts and contact groups

Parameters

Path parameters
Name Description
ContactID*
UUID (uuid)
Unique identifier for a Contact
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getContactAttachmentByFileName

Retrieves a specific attachment from a specific contact by file name


/Contacts/{ContactID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts/{ContactID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        String contentType = 'image/jpg';

        try {
            ByteArrayInputStream result = apiInstance.getContactAttachmentByFileName(accessToken, xeroTenantId, contactID, fileName, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getContactAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        String fileName = xero-dev.jpg; // String | Name of the attachment
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getContactAttachmentByFileName(xeroTenantId, contactID, fileName, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getContactAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific contact by file name
[apiInstance getContactAttachmentByFileNameWith:xeroTenantId
    contactID:contactID
    fileName:fileName
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getContactAttachmentByFileName(xeroTenantId, contactID, fileName, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetContactAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetContactAttachmentByFileNameAsync(accessToken, xeroTenantId, contactID, fileName, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetContactAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getContactAttachmentByFileName($xeroTenantId, $contactID, $fileName, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getContactAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getContactAttachmentByFileName(xeroTenantId => $xeroTenantId, contactID => $contactID, fileName => $fileName, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getContactAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_contact_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    contact_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_contact_attachment_by_file_name(xero_tenant_id, contact_id, file_name, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getContactAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getContactAttachmentByFileName(xeroTenantId, contactID, fileName, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
ContactID*
UUID (uuid)
Unique identifier for a Contact
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getContactAttachmentById

Retrieves a specific attachment from a specific contact using a unique attachment Id


/Contacts/{ContactID}/Attachments/{AttachmentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts/{ContactID}/Attachments/{AttachmentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID attachmentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String contentType = 'image/jpg';

        try {
            ByteArrayInputStream result = apiInstance.getContactAttachmentById(accessToken, xeroTenantId, contactID, attachmentID, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getContactAttachmentById");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        UUID attachmentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Attachment object
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getContactAttachmentById(xeroTenantId, contactID, attachmentID, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getContactAttachmentById");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)
UUID *attachmentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Attachment object (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific contact using a unique attachment Id
[apiInstance getContactAttachmentByIdWith:xeroTenantId
    contactID:contactID
    attachmentID:attachmentID
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactID = '00000000-0000-0000-0000-000000000000';
const attachmentID = '00000000-0000-0000-0000-000000000000';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getContactAttachmentById(xeroTenantId, contactID, attachmentID, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetContactAttachmentByIdExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var attachmentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetContactAttachmentByIdAsync(accessToken, xeroTenantId, contactID, attachmentID, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetContactAttachmentById: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactID = "00000000-0000-0000-0000-000000000000";
$attachmentID = "00000000-0000-0000-0000-000000000000";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getContactAttachmentById($xeroTenantId, $contactID, $attachmentID, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getContactAttachmentById: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact
my $attachmentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Attachment object
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getContactAttachmentById(xeroTenantId => $xeroTenantId, contactID => $contactID, attachmentID => $attachmentID, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getContactAttachmentById: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_contact_attachment_by_id():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    contact_id = '00000000-0000-0000-0000-000000000000'
    attachment_id = '00000000-0000-0000-0000-000000000000'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_contact_attachment_by_id(xero_tenant_id, contact_id, attachment_id, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getContactAttachmentById: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID
    let attachmentID = 00000000-0000-0000-0000-000000000000; // UUID
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getContactAttachmentById(xeroTenantId, contactID, attachmentID, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
ContactID*
UUID (uuid)
Unique identifier for a Contact
Required
AttachmentID*
UUID (uuid)
Unique identifier for Attachment object
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getContactAttachments

Retrieves attachments for a specific contact in a Xero organisation


/Contacts/{ContactID}/Attachments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts/{ContactID}/Attachments"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Attachments result = apiInstance.getContactAttachments(accessToken, xeroTenantId, contactID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getContactAttachments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        try {
            Attachments result = apiInstance.getContactAttachments(xeroTenantId, contactID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getContactAttachments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves attachments for a specific contact in a Xero organisation
[apiInstance getContactAttachmentsWith:xeroTenantId
    contactID:contactID
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getContactAttachments(xeroTenantId, contactID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetContactAttachmentsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetContactAttachmentsAsync(accessToken, xeroTenantId, contactID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetContactAttachments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getContactAttachments($xeroTenantId, $contactID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getContactAttachments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact

eval { 
    my $result = $api_instance->getContactAttachments(xeroTenantId => $xeroTenantId, contactID => $contactID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getContactAttachments: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_contact_attachments():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    contact_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_contact_attachments(xero_tenant_id, contact_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getContactAttachments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getContactAttachments(xeroTenantId, contactID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
ContactID*
UUID (uuid)
Unique identifier for a Contact
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getContactByContactNumber

Retrieves a specific contact by contact number in a Xero organisation


/Contacts/{ContactNumber}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts/{ContactNumber}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        String contactNumber = 'SB2';

        try {
            Contacts result = apiInstance.getContactByContactNumber(accessToken, xeroTenantId, contactNumber);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getContactByContactNumber");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        String contactNumber = SB2; // String | This field is read only on the Xero contact screen, used to identify contacts in external systems (max length = 50).
        try {
            Contacts result = apiInstance.getContactByContactNumber(xeroTenantId, contactNumber);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getContactByContactNumber");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
String *contactNumber = SB2; // This field is read only on the Xero contact screen, used to identify contacts in external systems (max length = 50). (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific contact by contact number in a Xero organisation
[apiInstance getContactByContactNumberWith:xeroTenantId
    contactNumber:contactNumber
              completionHandler: ^(Contacts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactNumber = 'SB2';

try {
  const response = await xero.accountingApi.getContactByContactNumber(xeroTenantId, contactNumber);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetContactByContactNumberExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactNumber = "SB2";
            
            try {
                var result = await apiInstance.GetContactByContactNumberAsync(accessToken, xeroTenantId, contactNumber);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetContactByContactNumber: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactNumber = "SB2";

try {
  $result = $apiInstance->getContactByContactNumber($xeroTenantId, $contactNumber);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getContactByContactNumber: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactNumber = SB2; # String | This field is read only on the Xero contact screen, used to identify contacts in external systems (max length = 50).

eval { 
    my $result = $api_instance->getContactByContactNumber(xeroTenantId => $xeroTenantId, contactNumber => $contactNumber);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getContactByContactNumber: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_contact_by_contact_number():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    contact_number = 'SB2'
    
    try:
        api_response = api_instance.get_contact_by_contact_number(xero_tenant_id, contact_number)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getContactByContactNumber: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactNumber = SB2; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getContactByContactNumber(xeroTenantId, contactNumber, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts.read Grant read-only access to contacts and contact groups

Parameters

Path parameters
Name Description
ContactNumber*
String
This field is read only on the Xero contact screen, used to identify contacts in external systems (max length = 50).
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getContactCISSettings

Retrieves CIS settings for a specific contact in a Xero organisation


/Contacts/{ContactID}/CISSettings

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts/{ContactID}/CISSettings"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            CISSettings result = apiInstance.getContactCISSettings(accessToken, xeroTenantId, contactID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getContactCISSettings");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        try {
            CISSettings result = apiInstance.getContactCISSettings(xeroTenantId, contactID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getContactCISSettings");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves CIS settings for a specific contact in a Xero organisation
[apiInstance getContactCISSettingsWith:xeroTenantId
    contactID:contactID
              completionHandler: ^(CISSettings output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getContactCISSettings(xeroTenantId, contactID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetContactCISSettingsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetContactCISSettingsAsync(accessToken, xeroTenantId, contactID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetContactCISSettings: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getContactCISSettings($xeroTenantId, $contactID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getContactCISSettings: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact

eval { 
    my $result = $api_instance->getContactCISSettings(xeroTenantId => $xeroTenantId, contactID => $contactID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getContactCISSettings: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_contact_cis_settings():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    contact_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_contact_cis_settings(xero_tenant_id, contact_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getContactCISSettings: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getContactCISSettings(xeroTenantId, contactID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts.read Grant read-only access to contacts and contact groups

Parameters

Path parameters
Name Description
ContactID*
UUID (uuid)
Unique identifier for a Contact
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getContactGroup

Retrieves a specific contact group by using a unique contact group Id


/ContactGroups/{ContactGroupID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ContactGroups/{ContactGroupID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID contactGroupID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            ContactGroups result = apiInstance.getContactGroup(accessToken, xeroTenantId, contactGroupID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getContactGroup");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactGroupID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact Group
        try {
            ContactGroups result = apiInstance.getContactGroup(xeroTenantId, contactGroupID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getContactGroup");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactGroupID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact Group (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific contact group by using a unique contact group Id
[apiInstance getContactGroupWith:xeroTenantId
    contactGroupID:contactGroupID
              completionHandler: ^(ContactGroups output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactGroupID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getContactGroup(xeroTenantId, contactGroupID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetContactGroupExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactGroupID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetContactGroupAsync(accessToken, xeroTenantId, contactGroupID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetContactGroup: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactGroupID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getContactGroup($xeroTenantId, $contactGroupID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getContactGroup: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactGroupID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact Group

eval { 
    my $result = $api_instance->getContactGroup(xeroTenantId => $xeroTenantId, contactGroupID => $contactGroupID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getContactGroup: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_contact_group():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    contact_group_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_contact_group(xero_tenant_id, contact_group_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getContactGroup: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactGroupID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getContactGroup(xeroTenantId, contactGroupID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts.read Grant read-only access to contacts and contact groups

Parameters

Path parameters
Name Description
ContactGroupID*
UUID (uuid)
Unique identifier for a Contact Group
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getContactGroups

Retrieves the contact Id and name of all the contacts in a contact group


/ContactGroups

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ContactGroups?where=Status=="ACTIVE"&order=Name ASC"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        String where = 'Status=="ACTIVE"';
        String order = 'Name ASC';

        try {
            ContactGroups result = apiInstance.getContactGroups(accessToken, xeroTenantId, where, order);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getContactGroups");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        String where = Status=="ACTIVE"; // String | Filter by an any element
        String order = Name ASC; // String | Order by an any element
        try {
            ContactGroups result = apiInstance.getContactGroups(xeroTenantId, where, order);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getContactGroups");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
String *where = Status=="ACTIVE"; // Filter by an any element (optional) (default to null)
String *order = Name ASC; // Order by an any element (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves the contact Id and name of all the contacts in a contact group
[apiInstance getContactGroupsWith:xeroTenantId
    where:where
    order:order
              completionHandler: ^(ContactGroups output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const where = 'Status=="ACTIVE"';
const order = 'Name ASC';

try {
  const response = await xero.accountingApi.getContactGroups(xeroTenantId,  where, order);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetContactGroupsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var where = "Status==\"ACTIVE\"";
            var order = "Name ASC";
            
            try {
                var result = await apiInstance.GetContactGroupsAsync(accessToken, xeroTenantId, where, order);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetContactGroups: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\ContactGroup::STATUS_ACTIVE . '"";
$order = "Name ASC";

try {
  $result = $apiInstance->getContactGroups($xeroTenantId, $where, $order);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getContactGroups: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $where = Status=="ACTIVE"; # String | Filter by an any element
my $order = Name ASC; # String | Order by an any element

eval { 
    my $result = $api_instance->getContactGroups(xeroTenantId => $xeroTenantId, where => $where, order => $order);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getContactGroups: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_contact_groups():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    where = 'Status=="ACTIVE"'
    order = 'Name ASC'
    
    try:
        api_response = api_instance.get_contact_groups(xero_tenant_id, where, order)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getContactGroups: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let where = Status=="ACTIVE"; // String
    let order = Name ASC; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getContactGroups(xeroTenantId, where, order, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts.read Grant read-only access to contacts and contact groups

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element

getContactHistory

Retrieves history records for a specific contact


/Contacts/{ContactID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts/{ContactID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getContactHistory(accessToken, xeroTenantId, contactID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getContactHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        try {
            HistoryRecords result = apiInstance.getContactHistory(xeroTenantId, contactID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getContactHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history records for a specific contact
[apiInstance getContactHistoryWith:xeroTenantId
    contactID:contactID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getContactHistory(xeroTenantId, contactID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetContactHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetContactHistoryAsync(accessToken, xeroTenantId, contactID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetContactHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getContactHistory($xeroTenantId, $contactID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getContactHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact

eval { 
    my $result = $api_instance->getContactHistory(xeroTenantId => $xeroTenantId, contactID => $contactID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getContactHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_contact_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    contact_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_contact_history(xero_tenant_id, contact_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getContactHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getContactHistory(xeroTenantId, contactID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts.read Grant read-only access to contacts and contact groups

Parameters

Path parameters
Name Description
ContactID*
UUID (uuid)
Unique identifier for a Contact
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getContacts

Retrieves all contacts in a Xero organisation


/Contacts

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts?where=ContactStatus=="ACTIVE"&order=Name ASC&IDs="00000000-0000-0000-0000-000000000000"&page=1&includeArchived=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';

        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = 'ContactStatus=="ACTIVE"';
        String order = 'Name ASC';
        array[UUID] iDs = "00000000-0000-0000-0000-000000000000";
        Integer page = 1;
        Boolean includeArchived = true;

        try {
            Contacts result = apiInstance.getContacts(accessToken, xeroTenantId, ifModifiedSince, where, order, iDs, page, includeArchived);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getContacts");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = ContactStatus=="ACTIVE"; // String | Filter by an any element
        String order = Name ASC; // String | Order by an any element
        array[UUID] iDs = "00000000-0000-0000-0000-000000000000"; // array[UUID] | Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call.
        Integer page = 1; // Integer | e.g. page=1 - Up to 100 contacts will be returned in a single API call.
        Boolean includeArchived = true; // Boolean | e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response
        try {
            Contacts result = apiInstance.getContacts(xeroTenantId, ifModifiedSince, where, order, iDs, page, includeArchived);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getContacts");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = ContactStatus=="ACTIVE"; // Filter by an any element (optional) (default to null)
String *order = Name ASC; // Order by an any element (optional) (default to null)
array[UUID] *iDs = "00000000-0000-0000-0000-000000000000"; // Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call. (optional) (default to null)
Integer *page = 1; // e.g. page=1 - Up to 100 contacts will be returned in a single API call. (optional) (default to null)
Boolean *includeArchived = true; // e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves all contacts in a Xero organisation
[apiInstance getContactsWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
    iDs:iDs
    page:page
    includeArchived:includeArchived
              completionHandler: ^(Contacts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'ContactStatus=="ACTIVE"';
const order = 'Name ASC';
const iDs = ["00000000-0000-0000-0000-000000000000"];
const page = 1;
const includeArchived = true;

try {
  const response = await xero.accountingApi.getContacts(xeroTenantId, ifModifiedSince, where, order, iDs, page, includeArchived);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetContactsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var ifModifiedSince = DateTime.Parse("2020-02-06T12:17:43.202-08:00");
            var where = "ContactStatus==\"ACTIVE\"";
            var order = "Name ASC";
            var iDs = new List<Guid>{Guid.Parse("00000000-0000-0000-0000-000000000000")};
            var page = 1;
            var includeArchived = true;
            
            try {
                var result = await apiInstance.GetContactsAsync(accessToken, xeroTenantId, ifModifiedSince, where, order, iDs, page, includeArchived);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetContacts: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "ContactStatus=="' . \XeroAPI\XeroPHP\Models\Accounting\Contact::CONTACT_STATUS_ACTIVE . '"";
$order = "Name ASC";
$iDs = array("00000000-0000-0000-0000-000000000000")
$page = 1;
$includeArchived = true;

try {
  $result = $apiInstance->getContacts($xeroTenantId, $ifModifiedSince, $where, $order, $iDs, $page, $includeArchived);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getContacts: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = ContactStatus=="ACTIVE"; # String | Filter by an any element
my $order = Name ASC; # String | Order by an any element
my $iDs = ["00000000-0000-0000-0000-000000000000"]; # array[UUID] | Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call.
my $page = 1; # Integer | e.g. page=1 - Up to 100 contacts will be returned in a single API call.
my $includeArchived = true; # Boolean | e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response

eval { 
    my $result = $api_instance->getContacts(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order, iDs => $iDs, page => $page, includeArchived => $includeArchived);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getContacts: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_contacts():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    if_modified_since = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'ContactStatus=="ACTIVE"'
    order = 'Name ASC'
    ids = ["00000000-0000-0000-0000-000000000000"]
    include_archived = 'true'
    
    try:
        api_response = api_instance.get_contacts(xero_tenant_id, if_modified_since, where, order, ids, page, include_archived)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getContacts: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = ContactStatus=="ACTIVE"; // String
    let order = Name ASC; // String
    let iDs = "00000000-0000-0000-0000-000000000000"; // array[UUID]
    let page = 1; // Integer
    let includeArchived = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.getContacts(xeroTenantId, ifModifiedSince, where, order, iDs, page, includeArchived, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts.read Grant read-only access to contacts and contact groups

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element
IDs
array[UUID] (uuid)
Filter by a comma separated list of ContactIDs. Allows you to retrieve a specific set of contacts in a single call.
page
Integer
e.g. page=1 - Up to 100 contacts will be returned in a single API call.
includeArchived
Boolean
e.g. includeArchived=true - Contacts with a status of ARCHIVED will be included in the response

getCreditNote

Retrieves a specific credit note using a unique credit note Id


/CreditNotes/{CreditNoteID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes/{CreditNoteID}?unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID creditNoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Integer unitdp = 4;

        try {
            CreditNotes result = apiInstance.getCreditNote(accessToken, xeroTenantId, creditNoteID, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNote");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Credit Note
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            CreditNotes result = apiInstance.getCreditNote(xeroTenantId, creditNoteID, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNote");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *creditNoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Credit Note (default to null)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific credit note using a unique credit note Id
[apiInstance getCreditNoteWith:xeroTenantId
    creditNoteID:creditNoteID
    unitdp:unitdp
              completionHandler: ^(CreditNotes output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const creditNoteID = '00000000-0000-0000-0000-000000000000';
const unitdp = 4;

try {
  const response = await xero.accountingApi.getCreditNote(xeroTenantId, creditNoteID,  unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetCreditNoteExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var creditNoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var unitdp = 4;
            
            try {
                var result = await apiInstance.GetCreditNoteAsync(accessToken, xeroTenantId, creditNoteID, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetCreditNote: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$creditNoteID = "00000000-0000-0000-0000-000000000000";
$unitdp = 4;

try {
  $result = $apiInstance->getCreditNote($xeroTenantId, $creditNoteID, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getCreditNote: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Credit Note
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->getCreditNote(xeroTenantId => $xeroTenantId, creditNoteID => $creditNoteID, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getCreditNote: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_credit_note():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    credit_note_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_credit_note(xero_tenant_id, credit_note_id, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getCreditNote: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getCreditNote(xeroTenantId, creditNoteID, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
CreditNoteID*
UUID (uuid)
Unique identifier for a Credit Note
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

getCreditNoteAsPdf

Retrieves credit notes as PDF files


/CreditNotes/{CreditNoteID}/pdf

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes/{CreditNoteID}/pdf"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID creditNoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            ByteArrayInputStream result = apiInstance.getCreditNoteAsPdf(accessToken, xeroTenantId, creditNoteID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNoteAsPdf");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Credit Note
        try {
            File result = apiInstance.getCreditNoteAsPdf(xeroTenantId, creditNoteID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNoteAsPdf");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *creditNoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Credit Note (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves credit notes as PDF files
[apiInstance getCreditNoteAsPdfWith:xeroTenantId
    creditNoteID:creditNoteID
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const creditNoteID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getCreditNoteAsPdf(xeroTenantId, creditNoteID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetCreditNoteAsPdfExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var creditNoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetCreditNoteAsPdfAsync(accessToken, xeroTenantId, creditNoteID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetCreditNoteAsPdf: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$creditNoteID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getCreditNoteAsPdf($xeroTenantId, $creditNoteID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getCreditNoteAsPdf: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Credit Note

eval { 
    my $result = $api_instance->getCreditNoteAsPdf(xeroTenantId => $xeroTenantId, creditNoteID => $creditNoteID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getCreditNoteAsPdf: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_credit_note_as_pdf():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    credit_note_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_credit_note_as_pdf(xero_tenant_id, credit_note_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getCreditNoteAsPdf: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getCreditNoteAsPdf(xeroTenantId, creditNoteID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
CreditNoteID*
UUID (uuid)
Unique identifier for a Credit Note
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getCreditNoteAttachmentByFileName

Retrieves a specific attachment on a specific credit note by file name


/CreditNotes/{CreditNoteID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes/{CreditNoteID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID creditNoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        String contentType = 'image/jpg';

        try {
            ByteArrayInputStream result = apiInstance.getCreditNoteAttachmentByFileName(accessToken, xeroTenantId, creditNoteID, fileName, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNoteAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Credit Note
        String fileName = xero-dev.jpg; // String | Name of the attachment
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNoteAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *creditNoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Credit Note (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment on a specific credit note by file name
[apiInstance getCreditNoteAttachmentByFileNameWith:xeroTenantId
    creditNoteID:creditNoteID
    fileName:fileName
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const creditNoteID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetCreditNoteAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var creditNoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetCreditNoteAttachmentByFileNameAsync(accessToken, xeroTenantId, creditNoteID, fileName, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetCreditNoteAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$creditNoteID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getCreditNoteAttachmentByFileName($xeroTenantId, $creditNoteID, $fileName, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getCreditNoteAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Credit Note
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getCreditNoteAttachmentByFileName(xeroTenantId => $xeroTenantId, creditNoteID => $creditNoteID, fileName => $fileName, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getCreditNoteAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_credit_note_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    credit_note_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_credit_note_attachment_by_file_name(xero_tenant_id, credit_note_id, file_name, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getCreditNoteAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
CreditNoteID*
UUID (uuid)
Unique identifier for a Credit Note
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getCreditNoteAttachmentById

Retrieves a specific attachment from a specific credit note using a unique attachment Id


/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes/{CreditNoteID}/Attachments/{AttachmentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID creditNoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID attachmentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String contentType = 'image/jpg';

        try {
            ByteArrayInputStream result = apiInstance.getCreditNoteAttachmentById(accessToken, xeroTenantId, creditNoteID, attachmentID, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNoteAttachmentById");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Credit Note
        UUID attachmentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Attachment object
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getCreditNoteAttachmentById(xeroTenantId, creditNoteID, attachmentID, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNoteAttachmentById");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *creditNoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Credit Note (default to null)
UUID *attachmentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Attachment object (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific credit note using a unique attachment Id
[apiInstance getCreditNoteAttachmentByIdWith:xeroTenantId
    creditNoteID:creditNoteID
    attachmentID:attachmentID
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const creditNoteID = '00000000-0000-0000-0000-000000000000';
const attachmentID = '00000000-0000-0000-0000-000000000000';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getCreditNoteAttachmentById(xeroTenantId, creditNoteID, attachmentID, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetCreditNoteAttachmentByIdExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var creditNoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var attachmentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetCreditNoteAttachmentByIdAsync(accessToken, xeroTenantId, creditNoteID, attachmentID, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetCreditNoteAttachmentById: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$creditNoteID = "00000000-0000-0000-0000-000000000000";
$attachmentID = "00000000-0000-0000-0000-000000000000";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getCreditNoteAttachmentById($xeroTenantId, $creditNoteID, $attachmentID, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getCreditNoteAttachmentById: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Credit Note
my $attachmentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Attachment object
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getCreditNoteAttachmentById(xeroTenantId => $xeroTenantId, creditNoteID => $creditNoteID, attachmentID => $attachmentID, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getCreditNoteAttachmentById: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_credit_note_attachment_by_id():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    credit_note_id = '00000000-0000-0000-0000-000000000000'
    attachment_id = '00000000-0000-0000-0000-000000000000'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_credit_note_attachment_by_id(xero_tenant_id, credit_note_id, attachment_id, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getCreditNoteAttachmentById: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let attachmentID = 00000000-0000-0000-0000-000000000000; // UUID
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getCreditNoteAttachmentById(xeroTenantId, creditNoteID, attachmentID, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
CreditNoteID*
UUID (uuid)
Unique identifier for a Credit Note
Required
AttachmentID*
UUID (uuid)
Unique identifier for Attachment object
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getCreditNoteAttachments

Retrieves attachments for a specific credit notes


/CreditNotes/{CreditNoteID}/Attachments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes/{CreditNoteID}/Attachments"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID creditNoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Attachments result = apiInstance.getCreditNoteAttachments(accessToken, xeroTenantId, creditNoteID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNoteAttachments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Credit Note
        try {
            Attachments result = apiInstance.getCreditNoteAttachments(xeroTenantId, creditNoteID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNoteAttachments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *creditNoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Credit Note (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves attachments for a specific credit notes
[apiInstance getCreditNoteAttachmentsWith:xeroTenantId
    creditNoteID:creditNoteID
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const creditNoteID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getCreditNoteAttachments(xeroTenantId, creditNoteID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetCreditNoteAttachmentsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var creditNoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetCreditNoteAttachmentsAsync(accessToken, xeroTenantId, creditNoteID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetCreditNoteAttachments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$creditNoteID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getCreditNoteAttachments($xeroTenantId, $creditNoteID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getCreditNoteAttachments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Credit Note

eval { 
    my $result = $api_instance->getCreditNoteAttachments(xeroTenantId => $xeroTenantId, creditNoteID => $creditNoteID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getCreditNoteAttachments: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_credit_note_attachments():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    credit_note_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_credit_note_attachments(xero_tenant_id, credit_note_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getCreditNoteAttachments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getCreditNoteAttachments(xeroTenantId, creditNoteID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
CreditNoteID*
UUID (uuid)
Unique identifier for a Credit Note
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getCreditNoteHistory

Retrieves history records of a specific credit note


/CreditNotes/{CreditNoteID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes/{CreditNoteID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID creditNoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getCreditNoteHistory(accessToken, xeroTenantId, creditNoteID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNoteHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Credit Note
        try {
            HistoryRecords result = apiInstance.getCreditNoteHistory(xeroTenantId, creditNoteID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNoteHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *creditNoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Credit Note (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history records of a specific credit note
[apiInstance getCreditNoteHistoryWith:xeroTenantId
    creditNoteID:creditNoteID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const creditNoteID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getCreditNoteHistory(xeroTenantId, creditNoteID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetCreditNoteHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var creditNoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetCreditNoteHistoryAsync(accessToken, xeroTenantId, creditNoteID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetCreditNoteHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$creditNoteID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getCreditNoteHistory($xeroTenantId, $creditNoteID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getCreditNoteHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Credit Note

eval { 
    my $result = $api_instance->getCreditNoteHistory(xeroTenantId => $xeroTenantId, creditNoteID => $creditNoteID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getCreditNoteHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_credit_note_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    credit_note_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_credit_note_history(xero_tenant_id, credit_note_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getCreditNoteHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getCreditNoteHistory(xeroTenantId, creditNoteID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
CreditNoteID*
UUID (uuid)
Unique identifier for a Credit Note
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getCreditNotes

Retrieves any credit notes


/CreditNotes

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes?where=Status=="DRAFT"&order=CreditNoteNumber ASC&page=1&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';

        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = 'Status=="DRAFT"';
        String order = 'CreditNoteNumber ASC';
        Integer page = 1;
        Integer unitdp = 4;

        try {
            CreditNotes result = apiInstance.getCreditNotes(accessToken, xeroTenantId, ifModifiedSince, where, order, page, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNotes");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = Status=="DRAFT"; // String | Filter by an any element
        String order = CreditNoteNumber ASC; // String | Order by an any element
        Integer page = 1; // Integer | e.g. page=1 – Up to 100 credit notes will be returned in a single API call with line items shown for each credit note
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            CreditNotes result = apiInstance.getCreditNotes(xeroTenantId, ifModifiedSince, where, order, page, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getCreditNotes");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = Status=="DRAFT"; // Filter by an any element (optional) (default to null)
String *order = CreditNoteNumber ASC; // Order by an any element (optional) (default to null)
Integer *page = 1; // e.g. page=1 – Up to 100 credit notes will be returned in a single API call with line items shown for each credit note (optional) (default to null)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves any credit notes
[apiInstance getCreditNotesWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
    page:page
    unitdp:unitdp
              completionHandler: ^(CreditNotes output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="DRAFT"';
const order = 'CreditNoteNumber ASC';
const page = 1;
const unitdp = 4;

try {
  const response = await xero.accountingApi.getCreditNotes(xeroTenantId, ifModifiedSince, where, order, page, unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetCreditNotesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var ifModifiedSince = DateTime.Parse("2020-02-06T12:17:43.202-08:00");
            var where = "Status==\"DRAFT\"";
            var order = "CreditNoteNumber ASC";
            var page = 1;
            var unitdp = 4;
            
            try {
                var result = await apiInstance.GetCreditNotesAsync(accessToken, xeroTenantId, ifModifiedSince, where, order, page, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetCreditNotes: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\CreditNote::STATUS_DRAFT . '"";
$order = "CreditNoteNumber ASC";
$page = 1;
$unitdp = 4;

try {
  $result = $apiInstance->getCreditNotes($xeroTenantId, $ifModifiedSince, $where, $order, $page, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getCreditNotes: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = Status=="DRAFT"; # String | Filter by an any element
my $order = CreditNoteNumber ASC; # String | Order by an any element
my $page = 1; # Integer | e.g. page=1 – Up to 100 credit notes will be returned in a single API call with line items shown for each credit note
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->getCreditNotes(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order, page => $page, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getCreditNotes: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_credit_notes():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    if_modified_since = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="DRAFT"'
    order = 'CreditNoteNumber ASC'
    
    try:
        api_response = api_instance.get_credit_notes(xero_tenant_id, if_modified_since, where, order, page, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getCreditNotes: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = Status=="DRAFT"; // String
    let order = CreditNoteNumber ASC; // String
    let page = 1; // Integer
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getCreditNotes(xeroTenantId, ifModifiedSince, where, order, page, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element
page
Integer
e.g. page=1 – Up to 100 credit notes will be returned in a single API call with line items shown for each credit note
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

getCurrencies

Retrieves currencies for your Xero organisation


/Currencies

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Currencies?where=Code=="USD"&order=Code ASC"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        String where = 'Code=="USD"';
        String order = 'Code ASC';

        try {
            Currencies result = apiInstance.getCurrencies(accessToken, xeroTenantId, where, order);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getCurrencies");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        String where = Code=="USD"; // String | Filter by an any element
        String order = Code ASC; // String | Order by an any element
        try {
            Currencies result = apiInstance.getCurrencies(xeroTenantId, where, order);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getCurrencies");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
String *where = Code=="USD"; // Filter by an any element (optional) (default to null)
String *order = Code ASC; // Order by an any element (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves currencies for your Xero organisation
[apiInstance getCurrenciesWith:xeroTenantId
    where:where
    order:order
              completionHandler: ^(Currencies output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const where = 'Code=="USD"';
const order = 'Code ASC';

try {
  const response = await xero.accountingApi.getCurrencies(xeroTenantId,  where, order);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetCurrenciesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var where = "Code==\"USD\"";
            var order = "Code ASC";
            
            try {
                var result = await apiInstance.GetCurrenciesAsync(accessToken, xeroTenantId, where, order);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetCurrencies: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$where = "Code=="' . \XeroAPI\XeroPHP\Models\Accounting\CurrencyCode::USD . '"";
$order = "Code ASC";

try {
  $result = $apiInstance->getCurrencies($xeroTenantId, $where, $order);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getCurrencies: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $where = Code=="USD"; # String | Filter by an any element
my $order = Code ASC; # String | Order by an any element

eval { 
    my $result = $api_instance->getCurrencies(xeroTenantId => $xeroTenantId, where => $where, order => $order);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getCurrencies: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_currencies():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    where = 'Code=="USD"'
    order = 'Code ASC'
    
    try:
        api_response = api_instance.get_currencies(xero_tenant_id, where, order)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getCurrencies: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let where = Code=="USD"; // String
    let order = Code ASC; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getCurrencies(xeroTenantId, where, order, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element

getEmployee

Retrieves a specific employee used in Xero payrun using a unique employee Id


/Employees/{EmployeeID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Employees/{EmployeeID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID employeeID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Employees result = apiInstance.getEmployee(accessToken, xeroTenantId, employeeID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getEmployee");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID employeeID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Employee
        try {
            Employees result = apiInstance.getEmployee(xeroTenantId, employeeID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getEmployee");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *employeeID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Employee (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific employee used in Xero payrun using a unique employee Id
[apiInstance getEmployeeWith:xeroTenantId
    employeeID:employeeID
              completionHandler: ^(Employees output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const employeeID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getEmployee(xeroTenantId, employeeID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetEmployeeExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var employeeID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetEmployeeAsync(accessToken, xeroTenantId, employeeID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetEmployee: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$employeeID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getEmployee($xeroTenantId, $employeeID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getEmployee: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $employeeID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Employee

eval { 
    my $result = $api_instance->getEmployee(xeroTenantId => $xeroTenantId, employeeID => $employeeID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getEmployee: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_employee():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    employee_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_employee(xero_tenant_id, employee_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getEmployee: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let employeeID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getEmployee(xeroTenantId, employeeID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Path parameters
Name Description
EmployeeID*
UUID (uuid)
Unique identifier for a Employee
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getEmployees

Retrieves employees used in Xero payrun


/Employees

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Employees?where=Status=="ACTIVE"&order=LastName ASC"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';

        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = 'Status=="ACTIVE"';
        String order = 'LastName ASC';

        try {
            Employees result = apiInstance.getEmployees(accessToken, xeroTenantId, ifModifiedSince, where, order);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getEmployees");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = Status=="ACTIVE"; // String | Filter by an any element
        String order = LastName ASC; // String | Order by an any element
        try {
            Employees result = apiInstance.getEmployees(xeroTenantId, ifModifiedSince, where, order);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getEmployees");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = Status=="ACTIVE"; // Filter by an any element (optional) (default to null)
String *order = LastName ASC; // Order by an any element (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves employees used in Xero payrun
[apiInstance getEmployeesWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
              completionHandler: ^(Employees output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="ACTIVE"';
const order = 'LastName ASC';

try {
  const response = await xero.accountingApi.getEmployees(xeroTenantId, ifModifiedSince, where, order);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetEmployeesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var ifModifiedSince = DateTime.Parse("2020-02-06T12:17:43.202-08:00");
            var where = "Status==\"ACTIVE\"";
            var order = "LastName ASC";
            
            try {
                var result = await apiInstance.GetEmployeesAsync(accessToken, xeroTenantId, ifModifiedSince, where, order);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetEmployees: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\Employee::STATUS_ACTIVE . '"";
$order = "LastName ASC";

try {
  $result = $apiInstance->getEmployees($xeroTenantId, $ifModifiedSince, $where, $order);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getEmployees: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = Status=="ACTIVE"; # String | Filter by an any element
my $order = LastName ASC; # String | Order by an any element

eval { 
    my $result = $api_instance->getEmployees(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getEmployees: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_employees():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    if_modified_since = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="ACTIVE"'
    order = 'LastName ASC'
    
    try:
        api_response = api_instance.get_employees(xero_tenant_id, if_modified_since, where, order)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getEmployees: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = Status=="ACTIVE"; // String
    let order = LastName ASC; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getEmployees(xeroTenantId, ifModifiedSince, where, order, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element

getExpenseClaim

Retrieves a specific expense claim using a unique expense claim Id


/ExpenseClaims/{ExpenseClaimID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ExpenseClaims/{ExpenseClaimID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID expenseClaimID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            ExpenseClaims result = apiInstance.getExpenseClaim(accessToken, xeroTenantId, expenseClaimID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getExpenseClaim");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID expenseClaimID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a ExpenseClaim
        try {
            ExpenseClaims result = apiInstance.getExpenseClaim(xeroTenantId, expenseClaimID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getExpenseClaim");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *expenseClaimID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a ExpenseClaim (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific expense claim using a unique expense claim Id
[apiInstance getExpenseClaimWith:xeroTenantId
    expenseClaimID:expenseClaimID
              completionHandler: ^(ExpenseClaims output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const expenseClaimID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getExpenseClaim(xeroTenantId, expenseClaimID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetExpenseClaimExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var expenseClaimID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetExpenseClaimAsync(accessToken, xeroTenantId, expenseClaimID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetExpenseClaim: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$expenseClaimID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getExpenseClaim($xeroTenantId, $expenseClaimID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getExpenseClaim: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $expenseClaimID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a ExpenseClaim

eval { 
    my $result = $api_instance->getExpenseClaim(xeroTenantId => $xeroTenantId, expenseClaimID => $expenseClaimID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getExpenseClaim: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_expense_claim():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    expense_claim_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_expense_claim(xero_tenant_id, expense_claim_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getExpenseClaim: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let expenseClaimID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getExpenseClaim(xeroTenantId, expenseClaimID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
ExpenseClaimID*
UUID (uuid)
Unique identifier for a ExpenseClaim
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getExpenseClaimHistory

Retrieves history records of a specific expense claim


/ExpenseClaims/{ExpenseClaimID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ExpenseClaims/{ExpenseClaimID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID expenseClaimID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getExpenseClaimHistory(accessToken, xeroTenantId, expenseClaimID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getExpenseClaimHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID expenseClaimID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a ExpenseClaim
        try {
            HistoryRecords result = apiInstance.getExpenseClaimHistory(xeroTenantId, expenseClaimID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getExpenseClaimHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *expenseClaimID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a ExpenseClaim (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history records of a specific expense claim
[apiInstance getExpenseClaimHistoryWith:xeroTenantId
    expenseClaimID:expenseClaimID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const expenseClaimID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getExpenseClaimHistory(xeroTenantId, expenseClaimID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetExpenseClaimHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var expenseClaimID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetExpenseClaimHistoryAsync(accessToken, xeroTenantId, expenseClaimID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetExpenseClaimHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$expenseClaimID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getExpenseClaimHistory($xeroTenantId, $expenseClaimID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getExpenseClaimHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $expenseClaimID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a ExpenseClaim

eval { 
    my $result = $api_instance->getExpenseClaimHistory(xeroTenantId => $xeroTenantId, expenseClaimID => $expenseClaimID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getExpenseClaimHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_expense_claim_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    expense_claim_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_expense_claim_history(xero_tenant_id, expense_claim_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getExpenseClaimHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let expenseClaimID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getExpenseClaimHistory(xeroTenantId, expenseClaimID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
ExpenseClaimID*
UUID (uuid)
Unique identifier for a ExpenseClaim
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getExpenseClaims

Retrieves expense claims


/ExpenseClaims

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ExpenseClaims?where=Status=="SUBMITTED"&order=Status ASC"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';

        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = 'Status=="SUBMITTED"';
        String order = 'Status ASC';

        try {
            ExpenseClaims result = apiInstance.getExpenseClaims(accessToken, xeroTenantId, ifModifiedSince, where, order);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getExpenseClaims");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = Status=="SUBMITTED"; // String | Filter by an any element
        String order = Status ASC; // String | Order by an any element
        try {
            ExpenseClaims result = apiInstance.getExpenseClaims(xeroTenantId, ifModifiedSince, where, order);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getExpenseClaims");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = Status=="SUBMITTED"; // Filter by an any element (optional) (default to null)
String *order = Status ASC; // Order by an any element (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves expense claims
[apiInstance getExpenseClaimsWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
              completionHandler: ^(ExpenseClaims output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="SUBMITTED"';
const order = 'Status ASC';

try {
  const response = await xero.accountingApi.getExpenseClaims(xeroTenantId, ifModifiedSince, where, order);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetExpenseClaimsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var ifModifiedSince = DateTime.Parse("2020-02-06T12:17:43.202-08:00");
            var where = "Status==\"SUBMITTED\"";
            var order = "Status ASC";
            
            try {
                var result = await apiInstance.GetExpenseClaimsAsync(accessToken, xeroTenantId, ifModifiedSince, where, order);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetExpenseClaims: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\ExpenseClaim::STATUS_SUBMITTED . '"";
$order = "Status ASC";

try {
  $result = $apiInstance->getExpenseClaims($xeroTenantId, $ifModifiedSince, $where, $order);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getExpenseClaims: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = Status=="SUBMITTED"; # String | Filter by an any element
my $order = Status ASC; # String | Order by an any element

eval { 
    my $result = $api_instance->getExpenseClaims(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getExpenseClaims: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_expense_claims():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    if_modified_since = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="SUBMITTED"'
    order = 'Status ASC'
    
    try:
        api_response = api_instance.get_expense_claims(xero_tenant_id, if_modified_since, where, order)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getExpenseClaims: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = Status=="SUBMITTED"; // String
    let order = Status ASC; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getExpenseClaims(xeroTenantId, ifModifiedSince, where, order, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element

getInvoice

Retrieves a specific sales invoice or purchase bill using a unique invoice Id


/Invoices/{InvoiceID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}?unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID invoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Integer unitdp = 4;

        try {
            Invoices result = apiInstance.getInvoice(accessToken, xeroTenantId, invoiceID, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getInvoice");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID invoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Invoice
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Invoices result = apiInstance.getInvoice(xeroTenantId, invoiceID, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getInvoice");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *invoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Invoice (default to null)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific sales invoice or purchase bill using a unique invoice Id
[apiInstance getInvoiceWith:xeroTenantId
    invoiceID:invoiceID
    unitdp:unitdp
              completionHandler: ^(Invoices output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const invoiceID = '00000000-0000-0000-0000-000000000000';
const unitdp = 4;

try {
  const response = await xero.accountingApi.getInvoice(xeroTenantId, invoiceID,  unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetInvoiceExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var invoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var unitdp = 4;
            
            try {
                var result = await apiInstance.GetInvoiceAsync(accessToken, xeroTenantId, invoiceID, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetInvoice: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$invoiceID = "00000000-0000-0000-0000-000000000000";
$unitdp = 4;

try {
  $result = $apiInstance->getInvoice($xeroTenantId, $invoiceID, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getInvoice: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Invoice
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->getInvoice(xeroTenantId => $xeroTenantId, invoiceID => $invoiceID, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getInvoice: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_invoice():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    invoice_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_invoice(xero_tenant_id, invoice_id, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getInvoice: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getInvoice(xeroTenantId, invoiceID, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
InvoiceID*
UUID (uuid)
Unique identifier for an Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

getInvoiceAsPdf

Retrieves invoices or purchase bills as PDF files


/Invoices/{InvoiceID}/pdf

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}/pdf"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID invoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            ByteArrayInputStream result = apiInstance.getInvoiceAsPdf(accessToken, xeroTenantId, invoiceID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getInvoiceAsPdf");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID invoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Invoice
        try {
            File result = apiInstance.getInvoiceAsPdf(xeroTenantId, invoiceID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getInvoiceAsPdf");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *invoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Invoice (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves invoices or purchase bills as PDF files
[apiInstance getInvoiceAsPdfWith:xeroTenantId
    invoiceID:invoiceID
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const invoiceID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getInvoiceAsPdf(xeroTenantId, invoiceID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetInvoiceAsPdfExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var invoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetInvoiceAsPdfAsync(accessToken, xeroTenantId, invoiceID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetInvoiceAsPdf: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$invoiceID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getInvoiceAsPdf($xeroTenantId, $invoiceID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getInvoiceAsPdf: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Invoice

eval { 
    my $result = $api_instance->getInvoiceAsPdf(xeroTenantId => $xeroTenantId, invoiceID => $invoiceID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getInvoiceAsPdf: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_invoice_as_pdf():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    invoice_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_invoice_as_pdf(xero_tenant_id, invoice_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getInvoiceAsPdf: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoiceID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getInvoiceAsPdf(xeroTenantId, invoiceID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
InvoiceID*
UUID (uuid)
Unique identifier for an Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getInvoiceAttachmentByFileName

Retrieves an attachment from a specific invoice or purchase bill by filename


/Invoices/{InvoiceID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID invoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        String contentType = 'image/jpg';

        try {
            ByteArrayInputStream result = apiInstance.getInvoiceAttachmentByFileName(accessToken, xeroTenantId, invoiceID, fileName, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getInvoiceAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID invoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Invoice
        String fileName = xero-dev.jpg; // String | Name of the attachment
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getInvoiceAttachmentByFileName(xeroTenantId, invoiceID, fileName, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getInvoiceAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *invoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Invoice (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves an attachment from a specific invoice or purchase bill by filename
[apiInstance getInvoiceAttachmentByFileNameWith:xeroTenantId
    invoiceID:invoiceID
    fileName:fileName
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const invoiceID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getInvoiceAttachmentByFileName(xeroTenantId, invoiceID, fileName, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetInvoiceAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var invoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetInvoiceAttachmentByFileNameAsync(accessToken, xeroTenantId, invoiceID, fileName, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetInvoiceAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$invoiceID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getInvoiceAttachmentByFileName($xeroTenantId, $invoiceID, $fileName, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getInvoiceAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Invoice
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getInvoiceAttachmentByFileName(xeroTenantId => $xeroTenantId, invoiceID => $invoiceID, fileName => $fileName, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getInvoiceAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_invoice_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    invoice_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_invoice_attachment_by_file_name(xero_tenant_id, invoice_id, file_name, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getInvoiceAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getInvoiceAttachmentByFileName(xeroTenantId, invoiceID, fileName, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
InvoiceID*
UUID (uuid)
Unique identifier for an Invoice
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getInvoiceAttachmentById

Retrieves a specific attachment from a specific invoices or purchase bills by using a unique attachment Id


/Invoices/{InvoiceID}/Attachments/{AttachmentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}/Attachments/{AttachmentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID invoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID attachmentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String contentType = 'image/jpg';

        try {
            ByteArrayInputStream result = apiInstance.getInvoiceAttachmentById(accessToken, xeroTenantId, invoiceID, attachmentID, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getInvoiceAttachmentById");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID invoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Invoice
        UUID attachmentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Attachment object
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getInvoiceAttachmentById(xeroTenantId, invoiceID, attachmentID, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getInvoiceAttachmentById");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *invoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Invoice (default to null)
UUID *attachmentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Attachment object (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific invoices or purchase bills by using a unique attachment Id
[apiInstance getInvoiceAttachmentByIdWith:xeroTenantId
    invoiceID:invoiceID
    attachmentID:attachmentID
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const invoiceID = '00000000-0000-0000-0000-000000000000';
const attachmentID = '00000000-0000-0000-0000-000000000000';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getInvoiceAttachmentById(xeroTenantId, invoiceID, attachmentID, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetInvoiceAttachmentByIdExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var invoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var attachmentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetInvoiceAttachmentByIdAsync(accessToken, xeroTenantId, invoiceID, attachmentID, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetInvoiceAttachmentById: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$invoiceID = "00000000-0000-0000-0000-000000000000";
$attachmentID = "00000000-0000-0000-0000-000000000000";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getInvoiceAttachmentById($xeroTenantId, $invoiceID, $attachmentID, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getInvoiceAttachmentById: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Invoice
my $attachmentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Attachment object
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getInvoiceAttachmentById(xeroTenantId => $xeroTenantId, invoiceID => $invoiceID, attachmentID => $attachmentID, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getInvoiceAttachmentById: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_invoice_attachment_by_id():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    invoice_id = '00000000-0000-0000-0000-000000000000'
    attachment_id = '00000000-0000-0000-0000-000000000000'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_invoice_attachment_by_id(xero_tenant_id, invoice_id, attachment_id, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getInvoiceAttachmentById: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let attachmentID = 00000000-0000-0000-0000-000000000000; // UUID
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getInvoiceAttachmentById(xeroTenantId, invoiceID, attachmentID, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
InvoiceID*
UUID (uuid)
Unique identifier for an Invoice
Required
AttachmentID*
UUID (uuid)
Unique identifier for Attachment object
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getInvoiceAttachments

Retrieves attachments for a specific invoice or purchase bill


/Invoices/{InvoiceID}/Attachments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}/Attachments"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID invoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Attachments result = apiInstance.getInvoiceAttachments(accessToken, xeroTenantId, invoiceID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getInvoiceAttachments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID invoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Invoice
        try {
            Attachments result = apiInstance.getInvoiceAttachments(xeroTenantId, invoiceID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getInvoiceAttachments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *invoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Invoice (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves attachments for a specific invoice or purchase bill
[apiInstance getInvoiceAttachmentsWith:xeroTenantId
    invoiceID:invoiceID
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const invoiceID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getInvoiceAttachments(xeroTenantId, invoiceID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetInvoiceAttachmentsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var invoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetInvoiceAttachmentsAsync(accessToken, xeroTenantId, invoiceID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetInvoiceAttachments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$invoiceID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getInvoiceAttachments($xeroTenantId, $invoiceID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getInvoiceAttachments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Invoice

eval { 
    my $result = $api_instance->getInvoiceAttachments(xeroTenantId => $xeroTenantId, invoiceID => $invoiceID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getInvoiceAttachments: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_invoice_attachments():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    invoice_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_invoice_attachments(xero_tenant_id, invoice_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getInvoiceAttachments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoiceID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getInvoiceAttachments(xeroTenantId, invoiceID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
InvoiceID*
UUID (uuid)
Unique identifier for an Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getInvoiceHistory

Retrieves history records for a specific invoice


/Invoices/{InvoiceID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID invoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getInvoiceHistory(accessToken, xeroTenantId, invoiceID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getInvoiceHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID invoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Invoice
        try {
            HistoryRecords result = apiInstance.getInvoiceHistory(xeroTenantId, invoiceID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getInvoiceHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *invoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Invoice (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history records for a specific invoice
[apiInstance getInvoiceHistoryWith:xeroTenantId
    invoiceID:invoiceID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const invoiceID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getInvoiceHistory(xeroTenantId, invoiceID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetInvoiceHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var invoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetInvoiceHistoryAsync(accessToken, xeroTenantId, invoiceID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetInvoiceHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$invoiceID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getInvoiceHistory($xeroTenantId, $invoiceID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getInvoiceHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Invoice

eval { 
    my $result = $api_instance->getInvoiceHistory(xeroTenantId => $xeroTenantId, invoiceID => $invoiceID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getInvoiceHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_invoice_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    invoice_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_invoice_history(xero_tenant_id, invoice_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getInvoiceHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoiceID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getInvoiceHistory(xeroTenantId, invoiceID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
InvoiceID*
UUID (uuid)
Unique identifier for an Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getInvoiceReminders

Retrieves invoice reminder settings


/InvoiceReminders/Settings

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/InvoiceReminders/Settings"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';

        try {
            InvoiceReminders result = apiInstance.getInvoiceReminders(accessToken, xeroTenantId);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getInvoiceReminders");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        try {
            InvoiceReminders result = apiInstance.getInvoiceReminders(xeroTenantId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getInvoiceReminders");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves invoice reminder settings
[apiInstance getInvoiceRemindersWith:xeroTenantId
              completionHandler: ^(InvoiceReminders output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';

try {
  const response = await xero.accountingApi.getInvoiceReminders(xeroTenantId);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetInvoiceRemindersExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            
            try {
                var result = await apiInstance.GetInvoiceRemindersAsync(accessToken, xeroTenantId);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetInvoiceReminders: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

try {
  $result = $apiInstance->getInvoiceReminders($xeroTenantId);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getInvoiceReminders: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant

eval { 
    my $result = $api_instance->getInvoiceReminders(xeroTenantId => $xeroTenantId);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getInvoiceReminders: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_invoice_reminders():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    
    try:
        api_response = api_instance.get_invoice_reminders(xero_tenant_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getInvoiceReminders: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getInvoiceReminders(xeroTenantId, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getInvoices

Retrieves sales invoices or purchase bills


/Invoices

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices?where=Status=="DRAFT"&order=InvoiceNumber ASC&IDs="00000000-0000-0000-0000-000000000000"&InvoiceNumbers="INV-001", "INV-002"&ContactIDs="00000000-0000-0000-0000-000000000000"&Statuses="DRAFT", "SUBMITTED"&page=1&includeArchived=true&createdByMyApp=false&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';

        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = 'Status=="DRAFT"';
        String order = 'InvoiceNumber ASC';
        array[UUID] iDs = "00000000-0000-0000-0000-000000000000";
        array[String] invoiceNumbers = "INV-001", "INV-002";
        array[UUID] contactIDs = "00000000-0000-0000-0000-000000000000";
        array[String] statuses = "DRAFT", "SUBMITTED";
        Integer page = 1;
        Boolean includeArchived = true;
        Boolean createdByMyApp = false;
        Integer unitdp = 4;

        try {
            Invoices result = apiInstance.getInvoices(accessToken, xeroTenantId, ifModifiedSince, where, order, iDs, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getInvoices");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = Status=="DRAFT"; // String | Filter by an any element
        String order = InvoiceNumber ASC; // String | Order by an any element
        array[UUID] iDs = "00000000-0000-0000-0000-000000000000"; // array[UUID] | Filter by a comma-separated list of InvoicesIDs.
        array[String] invoiceNumbers = "INV-001", "INV-002"; // array[String] | Filter by a comma-separated list of InvoiceNumbers.
        array[UUID] contactIDs = "00000000-0000-0000-0000-000000000000"; // array[UUID] | Filter by a comma-separated list of ContactIDs.
        array[String] statuses = "DRAFT", "SUBMITTED"; // array[String] | Filter by a comma-separated list Statuses. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter.
        Integer page = 1; // Integer | e.g. page=1 – Up to 100 invoices will be returned in a single API call with line items shown for each invoice
        Boolean includeArchived = true; // Boolean | e.g. includeArchived=true - Invoices with a status of ARCHIVED will be included in the response
        Boolean createdByMyApp = false; // Boolean | When set to true you'll only retrieve Invoices created by your app
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Invoices result = apiInstance.getInvoices(xeroTenantId, ifModifiedSince, where, order, iDs, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getInvoices");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = Status=="DRAFT"; // Filter by an any element (optional) (default to null)
String *order = InvoiceNumber ASC; // Order by an any element (optional) (default to null)
array[UUID] *iDs = "00000000-0000-0000-0000-000000000000"; // Filter by a comma-separated list of InvoicesIDs. (optional) (default to null)
array[String] *invoiceNumbers = "INV-001", "INV-002"; // Filter by a comma-separated list of InvoiceNumbers. (optional) (default to null)
array[UUID] *contactIDs = "00000000-0000-0000-0000-000000000000"; // Filter by a comma-separated list of ContactIDs. (optional) (default to null)
array[String] *statuses = "DRAFT", "SUBMITTED"; // Filter by a comma-separated list Statuses. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter. (optional) (default to null)
Integer *page = 1; // e.g. page=1 – Up to 100 invoices will be returned in a single API call with line items shown for each invoice (optional) (default to null)
Boolean *includeArchived = true; // e.g. includeArchived=true - Invoices with a status of ARCHIVED will be included in the response (optional) (default to null)
Boolean *createdByMyApp = false; // When set to true you'll only retrieve Invoices created by your app (optional) (default to null)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves sales invoices or purchase bills
[apiInstance getInvoicesWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
    iDs:iDs
    invoiceNumbers:invoiceNumbers
    contactIDs:contactIDs
    statuses:statuses
    page:page
    includeArchived:includeArchived
    createdByMyApp:createdByMyApp
    unitdp:unitdp
              completionHandler: ^(Invoices output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="DRAFT"';
const order = 'InvoiceNumber ASC';
const iDs = ["00000000-0000-0000-0000-000000000000"];
const invoiceNumbers = ["INV-001", "INV-002"];
const contactIDs = ["00000000-0000-0000-0000-000000000000"];
const statuses = ["DRAFT", "SUBMITTED"];
const page = 1;
const includeArchived = true;
const createdByMyApp = false;
const unitdp = 4;

try {
  const response = await xero.accountingApi.getInvoices(xeroTenantId, ifModifiedSince, where, order, iDs, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetInvoicesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var ifModifiedSince = DateTime.Parse("2020-02-06T12:17:43.202-08:00");
            var where = "Status==\"DRAFT\"";
            var order = "InvoiceNumber ASC";
            var iDs = new List<Guid>{Guid.Parse("00000000-0000-0000-0000-000000000000")};
            var invoiceNumbers = new List<string>{"INV-001","INV-002"};
            var contactIDs = new List<Guid>{Guid.Parse("00000000-0000-0000-0000-000000000000")};
            var statuses = new List<string>{"DRAFT","SUBMITTED"};
            var page = 1;
            var includeArchived = true;
            var createdByMyApp = false;
            var unitdp = 4;
            
            try {
                var result = await apiInstance.GetInvoicesAsync(accessToken, xeroTenantId, ifModifiedSince, where, order, iDs, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetInvoices: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\Invoice::STATUS_DRAFT . '"";
$order = "InvoiceNumber ASC";
$iDs = array("00000000-0000-0000-0000-000000000000")
$invoiceNumbers = array("INV-001", "INV-002")
$contactIDs = array("00000000-0000-0000-0000-000000000000")
$statuses = array("DRAFT", "SUBMITTED")
$page = 1;
$includeArchived = true;
$createdByMyApp = false;
$unitdp = 4;

try {
  $result = $apiInstance->getInvoices($xeroTenantId, $ifModifiedSince, $where, $order, $iDs, $invoiceNumbers, $contactIDs, $statuses, $page, $includeArchived, $createdByMyApp, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getInvoices: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = Status=="DRAFT"; # String | Filter by an any element
my $order = InvoiceNumber ASC; # String | Order by an any element
my $iDs = ["00000000-0000-0000-0000-000000000000"]; # array[UUID] | Filter by a comma-separated list of InvoicesIDs.
my $invoiceNumbers = ["INV-001", "INV-002"]; # array[String] | Filter by a comma-separated list of InvoiceNumbers.
my $contactIDs = ["00000000-0000-0000-0000-000000000000"]; # array[UUID] | Filter by a comma-separated list of ContactIDs.
my $statuses = ["DRAFT", "SUBMITTED"]; # array[String] | Filter by a comma-separated list Statuses. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter.
my $page = 1; # Integer | e.g. page=1 – Up to 100 invoices will be returned in a single API call with line items shown for each invoice
my $includeArchived = true; # Boolean | e.g. includeArchived=true - Invoices with a status of ARCHIVED will be included in the response
my $createdByMyApp = false; # Boolean | When set to true you'll only retrieve Invoices created by your app
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->getInvoices(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order, iDs => $iDs, invoiceNumbers => $invoiceNumbers, contactIDs => $contactIDs, statuses => $statuses, page => $page, includeArchived => $includeArchived, createdByMyApp => $createdByMyApp, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getInvoices: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_invoices():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    if_modified_since = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="DRAFT"'
    order = 'InvoiceNumber ASC'
    ids = ["00000000-0000-0000-0000-000000000000"]
    invoice_numbers = ["INV-001", "INV-002"]
    contact_ids = ["00000000-0000-0000-0000-000000000000"]
    statuses = ["DRAFT", "SUBMITTED"]
    include_archived = 'true'
    created_by_my_app = 'false'
    
    try:
        api_response = api_instance.get_invoices(xero_tenant_id, if_modified_since, where, order, ids, invoice_numbers, contact_ids, statuses, page, include_archived, created_by_my_app, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getInvoices: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = Status=="DRAFT"; // String
    let order = InvoiceNumber ASC; // String
    let iDs = "00000000-0000-0000-0000-000000000000"; // array[UUID]
    let invoiceNumbers = "INV-001", "INV-002"; // array[String]
    let contactIDs = "00000000-0000-0000-0000-000000000000"; // array[UUID]
    let statuses = "DRAFT", "SUBMITTED"; // array[String]
    let page = 1; // Integer
    let includeArchived = true; // Boolean
    let createdByMyApp = false; // Boolean
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getInvoices(xeroTenantId, ifModifiedSince, where, order, iDs, invoiceNumbers, contactIDs, statuses, page, includeArchived, createdByMyApp, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element
IDs
array[UUID] (uuid)
Filter by a comma-separated list of InvoicesIDs.
InvoiceNumbers
array[String]
Filter by a comma-separated list of InvoiceNumbers.
ContactIDs
array[UUID] (uuid)
Filter by a comma-separated list of ContactIDs.
Statuses
array[String]
Filter by a comma-separated list Statuses. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter.
page
Integer
e.g. page=1 – Up to 100 invoices will be returned in a single API call with line items shown for each invoice
includeArchived
Boolean
e.g. includeArchived=true - Invoices with a status of ARCHIVED will be included in the response
createdByMyApp
Boolean
When set to true you'll only retrieve Invoices created by your app
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

getItem

Retrieves a specific item using a unique item Id


/Items/{ItemID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Items/{ItemID}?unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID itemID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Integer unitdp = 4;

        try {
            Items result = apiInstance.getItem(accessToken, xeroTenantId, itemID, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getItem");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID itemID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Item
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Items result = apiInstance.getItem(xeroTenantId, itemID, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getItem");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *itemID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Item (default to null)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific item using a unique item Id
[apiInstance getItemWith:xeroTenantId
    itemID:itemID
    unitdp:unitdp
              completionHandler: ^(Items output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const itemID = '00000000-0000-0000-0000-000000000000';
const unitdp = 4;

try {
  const response = await xero.accountingApi.getItem(xeroTenantId, itemID,  unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetItemExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var itemID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var unitdp = 4;
            
            try {
                var result = await apiInstance.GetItemAsync(accessToken, xeroTenantId, itemID, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetItem: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$itemID = "00000000-0000-0000-0000-000000000000";
$unitdp = 4;

try {
  $result = $apiInstance->getItem($xeroTenantId, $itemID, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getItem: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $itemID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Item
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->getItem(xeroTenantId => $xeroTenantId, itemID => $itemID, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getItem: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_item():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    item_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_item(xero_tenant_id, item_id, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getItem: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let itemID = 00000000-0000-0000-0000-000000000000; // UUID
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getItem(xeroTenantId, itemID, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Path parameters
Name Description
ItemID*
UUID (uuid)
Unique identifier for an Item
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

getItemHistory

Retrieves history for a specific item


/Items/{ItemID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Items/{ItemID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID itemID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getItemHistory(accessToken, xeroTenantId, itemID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getItemHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID itemID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Item
        try {
            HistoryRecords result = apiInstance.getItemHistory(xeroTenantId, itemID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getItemHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *itemID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Item (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history for a specific item
[apiInstance getItemHistoryWith:xeroTenantId
    itemID:itemID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const itemID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getItemHistory(xeroTenantId, itemID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetItemHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var itemID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetItemHistoryAsync(accessToken, xeroTenantId, itemID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetItemHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$itemID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getItemHistory($xeroTenantId, $itemID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getItemHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $itemID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Item

eval { 
    my $result = $api_instance->getItemHistory(xeroTenantId => $xeroTenantId, itemID => $itemID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getItemHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_item_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    item_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_item_history(xero_tenant_id, item_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getItemHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let itemID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getItemHistory(xeroTenantId, itemID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Path parameters
Name Description
ItemID*
UUID (uuid)
Unique identifier for an Item
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getItems

Retrieves items


/Items

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Items?where=IsSold==true&order=Code ASC&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';

        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = 'IsSold==true';
        String order = 'Code ASC';
        Integer unitdp = 4;

        try {
            Items result = apiInstance.getItems(accessToken, xeroTenantId, ifModifiedSince, where, order, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getItems");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = IsSold==true; // String | Filter by an any element
        String order = Code ASC; // String | Order by an any element
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Items result = apiInstance.getItems(xeroTenantId, ifModifiedSince, where, order, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getItems");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = IsSold==true; // Filter by an any element (optional) (default to null)
String *order = Code ASC; // Order by an any element (optional) (default to null)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves items
[apiInstance getItemsWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
    unitdp:unitdp
              completionHandler: ^(Items output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'IsSold==true';
const order = 'Code ASC';
const unitdp = 4;

try {
  const response = await xero.accountingApi.getItems(xeroTenantId, ifModifiedSince, where, order, unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetItemsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var ifModifiedSince = DateTime.Parse("2020-02-06T12:17:43.202-08:00");
            var where = "IsSold==true";
            var order = "Code ASC";
            var unitdp = 4;
            
            try {
                var result = await apiInstance.GetItemsAsync(accessToken, xeroTenantId, ifModifiedSince, where, order, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetItems: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "IsSold==true";
$order = "Code ASC";
$unitdp = 4;

try {
  $result = $apiInstance->getItems($xeroTenantId, $ifModifiedSince, $where, $order, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getItems: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = IsSold==true; # String | Filter by an any element
my $order = Code ASC; # String | Order by an any element
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->getItems(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getItems: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_items():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    if_modified_since = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'IsSold==true'
    order = 'Code ASC'
    
    try:
        api_response = api_instance.get_items(xero_tenant_id, if_modified_since, where, order, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getItems: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = IsSold==true; // String
    let order = Code ASC; // String
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getItems(xeroTenantId, ifModifiedSince, where, order, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

getJournal

Retrieves a specific journal using a unique journal Id.


/Journals/{JournalID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Journals/{JournalID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID journalID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Journals result = apiInstance.getJournal(accessToken, xeroTenantId, journalID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getJournal");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID journalID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Journal
        try {
            Journals result = apiInstance.getJournal(xeroTenantId, journalID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getJournal");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *journalID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Journal (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific journal using a unique journal Id.
[apiInstance getJournalWith:xeroTenantId
    journalID:journalID
              completionHandler: ^(Journals output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const journalID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getJournal(xeroTenantId, journalID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetJournalExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var journalID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetJournalAsync(accessToken, xeroTenantId, journalID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetJournal: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$journalID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getJournal($xeroTenantId, $journalID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getJournal: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $journalID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Journal

eval { 
    my $result = $api_instance->getJournal(xeroTenantId => $xeroTenantId, journalID => $journalID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getJournal: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_journal():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    journal_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_journal(xero_tenant_id, journal_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getJournal: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let journalID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getJournal(xeroTenantId, journalID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.journals.read Grant read-only access to journals

Parameters

Path parameters
Name Description
JournalID*
UUID (uuid)
Unique identifier for a Journal
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getJournals

Retrieves journals


/Journals

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Journals?offset=10&paymentsOnly=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';

        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        Integer offset = 10;
        Boolean paymentsOnly = true;

        try {
            Journals result = apiInstance.getJournals(accessToken, xeroTenantId, ifModifiedSince, offset, paymentsOnly);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getJournals");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        Integer offset = 10; // Integer | Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned
        Boolean paymentsOnly = true; // Boolean | Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default.
        try {
            Journals result = apiInstance.getJournals(xeroTenantId, ifModifiedSince, offset, paymentsOnly);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getJournals");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
Integer *offset = 10; // Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned (optional) (default to null)
Boolean *paymentsOnly = true; // Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default. (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves journals
[apiInstance getJournalsWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    offset:offset
    paymentsOnly:paymentsOnly
              completionHandler: ^(Journals output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const offset = 10;
const paymentsOnly = true;

try {
  const response = await xero.accountingApi.getJournals(xeroTenantId, ifModifiedSince, offset, paymentsOnly);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetJournalsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var ifModifiedSince = DateTime.Parse("2020-02-06T12:17:43.202-08:00");
            var offset = 10;
            var paymentsOnly = true;
            
            try {
                var result = await apiInstance.GetJournalsAsync(accessToken, xeroTenantId, ifModifiedSince, offset, paymentsOnly);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetJournals: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$offset = 10;
$paymentsOnly = true;

try {
  $result = $apiInstance->getJournals($xeroTenantId, $ifModifiedSince, $offset, $paymentsOnly);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getJournals: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $offset = 10; # Integer | Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned
my $paymentsOnly = true; # Boolean | Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default.

eval { 
    my $result = $api_instance->getJournals(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, offset => $offset, paymentsOnly => $paymentsOnly);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getJournals: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_journals():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    if_modified_since = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    paymentsOnly = 'true'
    
    try:
        api_response = api_instance.get_journals(xero_tenant_id, if_modified_since, offset, paymentsOnly)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getJournals: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let offset = 10; // Integer
    let paymentsOnly = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.getJournals(xeroTenantId, ifModifiedSince, offset, paymentsOnly, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.journals.read Grant read-only access to journals

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
offset
Integer
Offset by a specified journal number. e.g. journals with a JournalNumber greater than the offset will be returned
paymentsOnly
Boolean
Filter to retrieve journals on a cash basis. Journals are returned on an accrual basis by default.

getLinkedTransaction

Retrieves a specific linked transaction (billable expenses) using a unique linked transaction Id


/LinkedTransactions/{LinkedTransactionID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/LinkedTransactions/{LinkedTransactionID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID linkedTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            LinkedTransactions result = apiInstance.getLinkedTransaction(accessToken, xeroTenantId, linkedTransactionID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getLinkedTransaction");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID linkedTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a LinkedTransaction
        try {
            LinkedTransactions result = apiInstance.getLinkedTransaction(xeroTenantId, linkedTransactionID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getLinkedTransaction");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *linkedTransactionID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a LinkedTransaction (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific linked transaction (billable expenses) using a unique linked transaction Id
[apiInstance getLinkedTransactionWith:xeroTenantId
    linkedTransactionID:linkedTransactionID
              completionHandler: ^(LinkedTransactions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const linkedTransactionID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getLinkedTransaction(xeroTenantId, linkedTransactionID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetLinkedTransactionExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var linkedTransactionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetLinkedTransactionAsync(accessToken, xeroTenantId, linkedTransactionID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetLinkedTransaction: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$linkedTransactionID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getLinkedTransaction($xeroTenantId, $linkedTransactionID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getLinkedTransaction: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $linkedTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a LinkedTransaction

eval { 
    my $result = $api_instance->getLinkedTransaction(xeroTenantId => $xeroTenantId, linkedTransactionID => $linkedTransactionID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getLinkedTransaction: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_linked_transaction():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    linked_transaction_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_linked_transaction(xero_tenant_id, linked_transaction_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getLinkedTransaction: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let linkedTransactionID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getLinkedTransaction(xeroTenantId, linkedTransactionID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
LinkedTransactionID*
UUID (uuid)
Unique identifier for a LinkedTransaction
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getLinkedTransactions

Retrieves linked transactions (billable expenses)


/LinkedTransactions

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/LinkedTransactions?page=1&LinkedTransactionID=00000000-0000-0000-0000-000000000000&SourceTransactionID=00000000-0000-0000-0000-000000000000&ContactID=00000000-0000-0000-0000-000000000000&Status=APPROVED&TargetTransactionID=00000000-0000-0000-0000-000000000000"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        Integer page = 1;
        UUID linkedTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID sourceTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String status = 'APPROVED';
        UUID targetTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            LinkedTransactions result = apiInstance.getLinkedTransactions(accessToken, xeroTenantId, page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getLinkedTransactions");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Integer page = 1; // Integer | Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page=1.
        UUID linkedTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | The Xero identifier for an Linked Transaction
        UUID sourceTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Filter by the SourceTransactionID. Get the linked transactions created from a particular ACCPAY invoice
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Filter by the ContactID. Get all the linked transactions that have been assigned to a particular customer.
        String status = APPROVED; // String | Filter by the combination of ContactID and Status. Get  the linked transactions associated to a  customer and with a status
        UUID targetTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Filter by the TargetTransactionID. Get all the linked transactions allocated to a particular ACCREC invoice
        try {
            LinkedTransactions result = apiInstance.getLinkedTransactions(xeroTenantId, page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getLinkedTransactions");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Integer *page = 1; // Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page=1. (optional) (default to null)
UUID *linkedTransactionID = 00000000-0000-0000-0000-000000000000; // The Xero identifier for an Linked Transaction (optional) (default to null)
UUID *sourceTransactionID = 00000000-0000-0000-0000-000000000000; // Filter by the SourceTransactionID. Get the linked transactions created from a particular ACCPAY invoice (optional) (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Filter by the ContactID. Get all the linked transactions that have been assigned to a particular customer. (optional) (default to null)
String *status = APPROVED; // Filter by the combination of ContactID and Status. Get  the linked transactions associated to a  customer and with a status (optional) (default to null)
UUID *targetTransactionID = 00000000-0000-0000-0000-000000000000; // Filter by the TargetTransactionID. Get all the linked transactions allocated to a particular ACCREC invoice (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves linked transactions (billable expenses)
[apiInstance getLinkedTransactionsWith:xeroTenantId
    page:page
    linkedTransactionID:linkedTransactionID
    sourceTransactionID:sourceTransactionID
    contactID:contactID
    status:status
    targetTransactionID:targetTransactionID
              completionHandler: ^(LinkedTransactions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const page = 1;
const linkedTransactionID = '00000000-0000-0000-0000-000000000000';
const sourceTransactionID = '00000000-0000-0000-0000-000000000000';
const contactID = '00000000-0000-0000-0000-000000000000';
const status = 'APPROVED';
const targetTransactionID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getLinkedTransactions(xeroTenantId,  page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetLinkedTransactionsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var page = 1;
            var linkedTransactionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var sourceTransactionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var contactID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var status = "APPROVED";
            var targetTransactionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetLinkedTransactionsAsync(accessToken, xeroTenantId, page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetLinkedTransactions: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$page = 1;
$linkedTransactionID = "00000000-0000-0000-0000-000000000000";
$sourceTransactionID = "00000000-0000-0000-0000-000000000000";
$contactID = "00000000-0000-0000-0000-000000000000";
$status = "APPROVED";
$targetTransactionID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getLinkedTransactions($xeroTenantId, $page, $linkedTransactionID, $sourceTransactionID, $contactID, $status, $targetTransactionID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getLinkedTransactions: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $page = 1; # Integer | Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page=1.
my $linkedTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | The Xero identifier for an Linked Transaction
my $sourceTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Filter by the SourceTransactionID. Get the linked transactions created from a particular ACCPAY invoice
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Filter by the ContactID. Get all the linked transactions that have been assigned to a particular customer.
my $status = APPROVED; # String | Filter by the combination of ContactID and Status. Get  the linked transactions associated to a  customer and with a status
my $targetTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Filter by the TargetTransactionID. Get all the linked transactions allocated to a particular ACCREC invoice

eval { 
    my $result = $api_instance->getLinkedTransactions(xeroTenantId => $xeroTenantId, page => $page, linkedTransactionID => $linkedTransactionID, sourceTransactionID => $sourceTransactionID, contactID => $contactID, status => $status, targetTransactionID => $targetTransactionID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getLinkedTransactions: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_linked_transactions():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    linked_transaction_id = '00000000-0000-0000-0000-000000000000'
    source_transaction_id = '00000000-0000-0000-0000-000000000000'
    contact_id = '00000000-0000-0000-0000-000000000000'
    status = 'APPROVED'
    target_transaction_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_linked_transactions(xero_tenant_id, page, linked_transaction_id, source_transaction_id, contact_id, status, target_transaction_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getLinkedTransactions: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let page = 1; // Integer
    let linkedTransactionID = 00000000-0000-0000-0000-000000000000; // UUID
    let sourceTransactionID = 00000000-0000-0000-0000-000000000000; // UUID
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID
    let status = APPROVED; // String
    let targetTransactionID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getLinkedTransactions(xeroTenantId, page, linkedTransactionID, sourceTransactionID, contactID, status, targetTransactionID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
page
Integer
Up to 100 linked transactions will be returned in a single API call. Use the page parameter to specify the page to be returned e.g. page=1.
LinkedTransactionID
UUID (uuid)
The Xero identifier for an Linked Transaction
SourceTransactionID
UUID (uuid)
Filter by the SourceTransactionID. Get the linked transactions created from a particular ACCPAY invoice
ContactID
UUID (uuid)
Filter by the ContactID. Get all the linked transactions that have been assigned to a particular customer.
Status
String
Filter by the combination of ContactID and Status. Get the linked transactions associated to a customer and with a status
TargetTransactionID
UUID (uuid)
Filter by the TargetTransactionID. Get all the linked transactions allocated to a particular ACCREC invoice

getManualJournal

Retrieves a specific manual journal


/ManualJournals/{ManualJournalID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ManualJournals/{ManualJournalID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID manualJournalID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            ManualJournals result = apiInstance.getManualJournal(accessToken, xeroTenantId, manualJournalID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getManualJournal");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a ManualJournal
        try {
            ManualJournals result = apiInstance.getManualJournal(xeroTenantId, manualJournalID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getManualJournal");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *manualJournalID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a ManualJournal (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific manual journal
[apiInstance getManualJournalWith:xeroTenantId
    manualJournalID:manualJournalID
              completionHandler: ^(ManualJournals output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const manualJournalID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getManualJournal(xeroTenantId, manualJournalID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetManualJournalExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var manualJournalID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetManualJournalAsync(accessToken, xeroTenantId, manualJournalID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetManualJournal: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$manualJournalID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getManualJournal($xeroTenantId, $manualJournalID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getManualJournal: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $manualJournalID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a ManualJournal

eval { 
    my $result = $api_instance->getManualJournal(xeroTenantId => $xeroTenantId, manualJournalID => $manualJournalID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getManualJournal: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_manual_journal():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    manual_journal_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_manual_journal(xero_tenant_id, manual_journal_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getManualJournal: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getManualJournal(xeroTenantId, manualJournalID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
ManualJournalID*
UUID (uuid)
Unique identifier for a ManualJournal
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getManualJournalAttachmentByFileName

Retrieves a specific attachment from a specific manual journal by file name


/ManualJournals/{ManualJournalID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ManualJournals/{ManualJournalID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID manualJournalID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        String contentType = 'image/jpg';

        try {
            ByteArrayInputStream result = apiInstance.getManualJournalAttachmentByFileName(accessToken, xeroTenantId, manualJournalID, fileName, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getManualJournalAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a ManualJournal
        String fileName = xero-dev.jpg; // String | Name of the attachment
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getManualJournalAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *manualJournalID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a ManualJournal (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific manual journal by file name
[apiInstance getManualJournalAttachmentByFileNameWith:xeroTenantId
    manualJournalID:manualJournalID
    fileName:fileName
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const manualJournalID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetManualJournalAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var manualJournalID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetManualJournalAttachmentByFileNameAsync(accessToken, xeroTenantId, manualJournalID, fileName, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetManualJournalAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$manualJournalID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getManualJournalAttachmentByFileName($xeroTenantId, $manualJournalID, $fileName, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getManualJournalAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $manualJournalID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a ManualJournal
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getManualJournalAttachmentByFileName(xeroTenantId => $xeroTenantId, manualJournalID => $manualJournalID, fileName => $fileName, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getManualJournalAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_manual_journal_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    manual_journal_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_manual_journal_attachment_by_file_name(xero_tenant_id, manual_journal_id, file_name, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getManualJournalAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
ManualJournalID*
UUID (uuid)
Unique identifier for a ManualJournal
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getManualJournalAttachmentById

Allows you to retrieve a specific attachment from a specific manual journal using a unique attachment Id


/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ManualJournals/{ManualJournalID}/Attachments/{AttachmentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID manualJournalID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID attachmentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String contentType = 'image/jpg';

        try {
            ByteArrayInputStream result = apiInstance.getManualJournalAttachmentById(accessToken, xeroTenantId, manualJournalID, attachmentID, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getManualJournalAttachmentById");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a ManualJournal
        UUID attachmentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Attachment object
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getManualJournalAttachmentById(xeroTenantId, manualJournalID, attachmentID, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getManualJournalAttachmentById");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *manualJournalID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a ManualJournal (default to null)
UUID *attachmentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Attachment object (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Allows you to retrieve a specific attachment from a specific manual journal using a unique attachment Id
[apiInstance getManualJournalAttachmentByIdWith:xeroTenantId
    manualJournalID:manualJournalID
    attachmentID:attachmentID
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const manualJournalID = '00000000-0000-0000-0000-000000000000';
const attachmentID = '00000000-0000-0000-0000-000000000000';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getManualJournalAttachmentById(xeroTenantId, manualJournalID, attachmentID, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetManualJournalAttachmentByIdExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var manualJournalID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var attachmentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetManualJournalAttachmentByIdAsync(accessToken, xeroTenantId, manualJournalID, attachmentID, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetManualJournalAttachmentById: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$manualJournalID = "00000000-0000-0000-0000-000000000000";
$attachmentID = "00000000-0000-0000-0000-000000000000";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getManualJournalAttachmentById($xeroTenantId, $manualJournalID, $attachmentID, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getManualJournalAttachmentById: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $manualJournalID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a ManualJournal
my $attachmentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Attachment object
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getManualJournalAttachmentById(xeroTenantId => $xeroTenantId, manualJournalID => $manualJournalID, attachmentID => $attachmentID, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getManualJournalAttachmentById: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_manual_journal_attachment_by_id():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    manual_journal_id = '00000000-0000-0000-0000-000000000000'
    attachment_id = '00000000-0000-0000-0000-000000000000'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_manual_journal_attachment_by_id(xero_tenant_id, manual_journal_id, attachment_id, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getManualJournalAttachmentById: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID
    let attachmentID = 00000000-0000-0000-0000-000000000000; // UUID
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getManualJournalAttachmentById(xeroTenantId, manualJournalID, attachmentID, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
ManualJournalID*
UUID (uuid)
Unique identifier for a ManualJournal
Required
AttachmentID*
UUID (uuid)
Unique identifier for Attachment object
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getManualJournalAttachments

Retrieves attachment for a specific manual journal


/ManualJournals/{ManualJournalID}/Attachments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ManualJournals/{ManualJournalID}/Attachments"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID manualJournalID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Attachments result = apiInstance.getManualJournalAttachments(accessToken, xeroTenantId, manualJournalID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getManualJournalAttachments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a ManualJournal
        try {
            Attachments result = apiInstance.getManualJournalAttachments(xeroTenantId, manualJournalID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getManualJournalAttachments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *manualJournalID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a ManualJournal (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves attachment for a specific manual journal
[apiInstance getManualJournalAttachmentsWith:xeroTenantId
    manualJournalID:manualJournalID
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const manualJournalID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getManualJournalAttachments(xeroTenantId, manualJournalID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetManualJournalAttachmentsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var manualJournalID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetManualJournalAttachmentsAsync(accessToken, xeroTenantId, manualJournalID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetManualJournalAttachments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$manualJournalID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getManualJournalAttachments($xeroTenantId, $manualJournalID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getManualJournalAttachments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $manualJournalID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a ManualJournal

eval { 
    my $result = $api_instance->getManualJournalAttachments(xeroTenantId => $xeroTenantId, manualJournalID => $manualJournalID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getManualJournalAttachments: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_manual_journal_attachments():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    manual_journal_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_manual_journal_attachments(xero_tenant_id, manual_journal_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getManualJournalAttachments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getManualJournalAttachments(xeroTenantId, manualJournalID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
ManualJournalID*
UUID (uuid)
Unique identifier for a ManualJournal
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getManualJournals

Retrieves manual journals


/ManualJournals

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ManualJournals?where=Status=="DRAFT"&order=Date ASC&page=1"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';

        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = 'Status=="DRAFT"';
        String order = 'Date ASC';
        Integer page = 1;

        try {
            ManualJournals result = apiInstance.getManualJournals(accessToken, xeroTenantId, ifModifiedSince, where, order, page);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getManualJournals");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = Status=="DRAFT"; // String | Filter by an any element
        String order = Date ASC; // String | Order by an any element
        Integer page = 1; // Integer | e.g. page=1 – Up to 100 manual journals will be returned in a single API call with line items shown for each overpayment
        try {
            ManualJournals result = apiInstance.getManualJournals(xeroTenantId, ifModifiedSince, where, order, page);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getManualJournals");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = Status=="DRAFT"; // Filter by an any element (optional) (default to null)
String *order = Date ASC; // Order by an any element (optional) (default to null)
Integer *page = 1; // e.g. page=1 – Up to 100 manual journals will be returned in a single API call with line items shown for each overpayment (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves manual journals
[apiInstance getManualJournalsWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
    page:page
              completionHandler: ^(ManualJournals output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="DRAFT"';
const order = 'Date ASC';
const page = 1;

try {
  const response = await xero.accountingApi.getManualJournals(xeroTenantId, ifModifiedSince, where, order, page);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetManualJournalsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var ifModifiedSince = DateTime.Parse("2020-02-06T12:17:43.202-08:00");
            var where = "Status==\"DRAFT\"";
            var order = "Date ASC";
            var page = 1;
            
            try {
                var result = await apiInstance.GetManualJournalsAsync(accessToken, xeroTenantId, ifModifiedSince, where, order, page);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetManualJournals: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\ManualJournal::STATUS_DRAFT . '"";
$order = "Date ASC";
$page = 1;

try {
  $result = $apiInstance->getManualJournals($xeroTenantId, $ifModifiedSince, $where, $order, $page);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getManualJournals: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = Status=="DRAFT"; # String | Filter by an any element
my $order = Date ASC; # String | Order by an any element
my $page = 1; # Integer | e.g. page=1 – Up to 100 manual journals will be returned in a single API call with line items shown for each overpayment

eval { 
    my $result = $api_instance->getManualJournals(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order, page => $page);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getManualJournals: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_manual_journals():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    if_modified_since = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="DRAFT"'
    order = 'Date ASC'
    
    try:
        api_response = api_instance.get_manual_journals(xero_tenant_id, if_modified_since, where, order, page)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getManualJournals: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = Status=="DRAFT"; // String
    let order = Date ASC; // String
    let page = 1; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getManualJournals(xeroTenantId, ifModifiedSince, where, order, page, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element
page
Integer
e.g. page=1 – Up to 100 manual journals will be returned in a single API call with line items shown for each overpayment

getManualJournalsHistory

Retrieves history for a specific manual journal


/ManualJournals/{ManualJournalID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ManualJournals/{ManualJournalID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID manualJournalID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getManualJournalsHistory(accessToken, xeroTenantId, manualJournalID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getManualJournalsHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a ManualJournal
        try {
            HistoryRecords result = apiInstance.getManualJournalsHistory(xeroTenantId, manualJournalID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getManualJournalsHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *manualJournalID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a ManualJournal (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history for a specific manual journal
[apiInstance getManualJournalsHistoryWith:xeroTenantId
    manualJournalID:manualJournalID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const manualJournalID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getManualJournalsHistory(xeroTenantId, manualJournalID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetManualJournalsHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var manualJournalID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetManualJournalsHistoryAsync(accessToken, xeroTenantId, manualJournalID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetManualJournalsHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$manualJournalID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getManualJournalsHistory($xeroTenantId, $manualJournalID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getManualJournalsHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $manualJournalID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a ManualJournal

eval { 
    my $result = $api_instance->getManualJournalsHistory(xeroTenantId => $xeroTenantId, manualJournalID => $manualJournalID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getManualJournalsHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_manual_journals_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    manual_journal_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_manual_journals_history(xero_tenant_id, manual_journal_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getManualJournalsHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getManualJournalsHistory(xeroTenantId, manualJournalID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
ManualJournalID*
UUID (uuid)
Unique identifier for a ManualJournal
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getOnlineInvoice

Retrieves a URL to an online invoice


/Invoices/{InvoiceID}/OnlineInvoice

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}/OnlineInvoice"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID invoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            OnlineInvoices result = apiInstance.getOnlineInvoice(accessToken, xeroTenantId, invoiceID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getOnlineInvoice");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID invoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Invoice
        try {
            OnlineInvoices result = apiInstance.getOnlineInvoice(xeroTenantId, invoiceID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getOnlineInvoice");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *invoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Invoice (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a URL to an online invoice
[apiInstance getOnlineInvoiceWith:xeroTenantId
    invoiceID:invoiceID
              completionHandler: ^(OnlineInvoices output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const invoiceID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getOnlineInvoice(xeroTenantId, invoiceID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetOnlineInvoiceExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var invoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetOnlineInvoiceAsync(accessToken, xeroTenantId, invoiceID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetOnlineInvoice: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$invoiceID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getOnlineInvoice($xeroTenantId, $invoiceID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getOnlineInvoice: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Invoice

eval { 
    my $result = $api_instance->getOnlineInvoice(xeroTenantId => $xeroTenantId, invoiceID => $invoiceID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getOnlineInvoice: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_online_invoice():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    invoice_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_online_invoice(xero_tenant_id, invoice_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getOnlineInvoice: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoiceID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getOnlineInvoice(xeroTenantId, invoiceID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
InvoiceID*
UUID (uuid)
Unique identifier for an Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getOrganisationActions

Retrieves a list of the key actions your app has permission to perform in the connected Xero organisation.


/Organisation/Actions

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Organisation/Actions"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';

        try {
            Actions result = apiInstance.getOrganisationActions(accessToken, xeroTenantId);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getOrganisationActions");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        try {
            Actions result = apiInstance.getOrganisationActions(xeroTenantId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getOrganisationActions");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a list of the key actions your app has permission to perform in the connected Xero organisation.
[apiInstance getOrganisationActionsWith:xeroTenantId
              completionHandler: ^(Actions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';

try {
  const response = await xero.accountingApi.getOrganisationActions(xeroTenantId);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetOrganisationActionsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            
            try {
                var result = await apiInstance.GetOrganisationActionsAsync(accessToken, xeroTenantId);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetOrganisationActions: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

try {
  $result = $apiInstance->getOrganisationActions($xeroTenantId);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getOrganisationActions: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant

eval { 
    my $result = $api_instance->getOrganisationActions(xeroTenantId => $xeroTenantId);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getOrganisationActions: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_organisation_actions():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    
    try:
        api_response = api_instance.get_organisation_actions(xero_tenant_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getOrganisationActions: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getOrganisationActions(xeroTenantId, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getOrganisationCISSettings

Retrieves the CIS settings for the Xero organistaion.


/Organisation/{OrganisationID}/CISSettings

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Organisation/{OrganisationID}/CISSettings"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID organisationID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            CISOrgSettings result = apiInstance.getOrganisationCISSettings(accessToken, xeroTenantId, organisationID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getOrganisationCISSettings");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID organisationID = 00000000-0000-0000-0000-000000000000; // UUID | The unique Xero identifier for an organisation
        try {
            CISOrgSettings result = apiInstance.getOrganisationCISSettings(xeroTenantId, organisationID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getOrganisationCISSettings");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *organisationID = 00000000-0000-0000-0000-000000000000; // The unique Xero identifier for an organisation (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves the CIS settings for the Xero organistaion.
[apiInstance getOrganisationCISSettingsWith:xeroTenantId
    organisationID:organisationID
              completionHandler: ^(CISOrgSettings output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const organisationID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getOrganisationCISSettings(xeroTenantId, organisationID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetOrganisationCISSettingsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var organisationID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetOrganisationCISSettingsAsync(accessToken, xeroTenantId, organisationID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetOrganisationCISSettings: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$organisationID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getOrganisationCISSettings($xeroTenantId, $organisationID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getOrganisationCISSettings: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $organisationID = 00000000-0000-0000-0000-000000000000; # UUID | The unique Xero identifier for an organisation

eval { 
    my $result = $api_instance->getOrganisationCISSettings(xeroTenantId => $xeroTenantId, organisationID => $organisationID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getOrganisationCISSettings: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_organisation_cis_settings():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    organisation_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_organisation_cis_settings(xero_tenant_id, organisation_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getOrganisationCISSettings: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let organisationID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getOrganisationCISSettings(xeroTenantId, organisationID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Path parameters
Name Description
OrganisationID*
UUID (uuid)
The unique Xero identifier for an organisation
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getOrganisations

Retrieves Xero organisation details


/Organisation

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Organisation"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';

        try {
            Organisations result = apiInstance.getOrganisations(accessToken, xeroTenantId);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getOrganisations");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        try {
            Organisations result = apiInstance.getOrganisations(xeroTenantId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getOrganisations");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves Xero organisation details
[apiInstance getOrganisationsWith:xeroTenantId
              completionHandler: ^(Organisations output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';

try {
  const response = await xero.accountingApi.getOrganisations(xeroTenantId);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetOrganisationsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            
            try {
                var result = await apiInstance.GetOrganisationsAsync(accessToken, xeroTenantId);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetOrganisations: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

try {
  $result = $apiInstance->getOrganisations($xeroTenantId);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getOrganisations: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant

eval { 
    my $result = $api_instance->getOrganisations(xeroTenantId => $xeroTenantId);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getOrganisations: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_organisations():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    
    try:
        api_response = api_instance.get_organisations(xero_tenant_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getOrganisations: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getOrganisations(xeroTenantId, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getOverpayment

Retrieves a specific overpayment using a unique overpayment Id


/Overpayments/{OverpaymentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Overpayments/{OverpaymentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID overpaymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Overpayments result = apiInstance.getOverpayment(accessToken, xeroTenantId, overpaymentID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getOverpayment");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID overpaymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Overpayment
        try {
            Overpayments result = apiInstance.getOverpayment(xeroTenantId, overpaymentID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getOverpayment");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *overpaymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Overpayment (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific overpayment using a unique overpayment Id
[apiInstance getOverpaymentWith:xeroTenantId
    overpaymentID:overpaymentID
              completionHandler: ^(Overpayments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const overpaymentID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getOverpayment(xeroTenantId, overpaymentID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetOverpaymentExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var overpaymentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetOverpaymentAsync(accessToken, xeroTenantId, overpaymentID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetOverpayment: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$overpaymentID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getOverpayment($xeroTenantId, $overpaymentID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getOverpayment: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $overpaymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Overpayment

eval { 
    my $result = $api_instance->getOverpayment(xeroTenantId => $xeroTenantId, overpaymentID => $overpaymentID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getOverpayment: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_overpayment():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    overpayment_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_overpayment(xero_tenant_id, overpayment_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getOverpayment: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let overpaymentID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getOverpayment(xeroTenantId, overpaymentID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
OverpaymentID*
UUID (uuid)
Unique identifier for a Overpayment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getOverpaymentHistory

Retrieves history records of a specific overpayment


/Overpayments/{OverpaymentID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Overpayments/{OverpaymentID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID overpaymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getOverpaymentHistory(accessToken, xeroTenantId, overpaymentID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getOverpaymentHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID overpaymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Overpayment
        try {
            HistoryRecords result = apiInstance.getOverpaymentHistory(xeroTenantId, overpaymentID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getOverpaymentHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *overpaymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Overpayment (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history records of a specific overpayment
[apiInstance getOverpaymentHistoryWith:xeroTenantId
    overpaymentID:overpaymentID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const overpaymentID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getOverpaymentHistory(xeroTenantId, overpaymentID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetOverpaymentHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var overpaymentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetOverpaymentHistoryAsync(accessToken, xeroTenantId, overpaymentID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetOverpaymentHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$overpaymentID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getOverpaymentHistory($xeroTenantId, $overpaymentID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getOverpaymentHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $overpaymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Overpayment

eval { 
    my $result = $api_instance->getOverpaymentHistory(xeroTenantId => $xeroTenantId, overpaymentID => $overpaymentID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getOverpaymentHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_overpayment_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    overpayment_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_overpayment_history(xero_tenant_id, overpayment_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getOverpaymentHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let overpaymentID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getOverpaymentHistory(xeroTenantId, overpaymentID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
OverpaymentID*
UUID (uuid)
Unique identifier for a Overpayment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getOverpayments

Retrieves overpayments


/Overpayments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Overpayments?where=Status=="AUTHORISED"&order=Status ASC&page=1&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';

        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = 'Status=="AUTHORISED"';
        String order = 'Status ASC';
        Integer page = 1;
        Integer unitdp = 4;

        try {
            Overpayments result = apiInstance.getOverpayments(accessToken, xeroTenantId, ifModifiedSince, where, order, page, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getOverpayments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = Status=="AUTHORISED"; // String | Filter by an any element
        String order = Status ASC; // String | Order by an any element
        Integer page = 1; // Integer | e.g. page=1 – Up to 100 overpayments will be returned in a single API call with line items shown for each overpayment
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Overpayments result = apiInstance.getOverpayments(xeroTenantId, ifModifiedSince, where, order, page, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getOverpayments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = Status=="AUTHORISED"; // Filter by an any element (optional) (default to null)
String *order = Status ASC; // Order by an any element (optional) (default to null)
Integer *page = 1; // e.g. page=1 – Up to 100 overpayments will be returned in a single API call with line items shown for each overpayment (optional) (default to null)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves overpayments
[apiInstance getOverpaymentsWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
    page:page
    unitdp:unitdp
              completionHandler: ^(Overpayments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="AUTHORISED"';
const order = 'Status ASC';
const page = 1;
const unitdp = 4;

try {
  const response = await xero.accountingApi.getOverpayments(xeroTenantId, ifModifiedSince, where, order, page, unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetOverpaymentsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var ifModifiedSince = DateTime.Parse("2020-02-06T12:17:43.202-08:00");
            var where = "Status==\"AUTHORISED\"";
            var order = "Status ASC";
            var page = 1;
            var unitdp = 4;
            
            try {
                var result = await apiInstance.GetOverpaymentsAsync(accessToken, xeroTenantId, ifModifiedSince, where, order, page, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetOverpayments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\Overpayment::STATUS_AUTHORISED . '"";
$order = "Status ASC";
$page = 1;
$unitdp = 4;

try {
  $result = $apiInstance->getOverpayments($xeroTenantId, $ifModifiedSince, $where, $order, $page, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getOverpayments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = Status=="AUTHORISED"; # String | Filter by an any element
my $order = Status ASC; # String | Order by an any element
my $page = 1; # Integer | e.g. page=1 – Up to 100 overpayments will be returned in a single API call with line items shown for each overpayment
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->getOverpayments(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order, page => $page, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getOverpayments: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_overpayments():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    if_modified_since = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="AUTHORISED"'
    order = 'Status ASC'
    
    try:
        api_response = api_instance.get_overpayments(xero_tenant_id, if_modified_since, where, order, page, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getOverpayments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = Status=="AUTHORISED"; // String
    let order = Status ASC; // String
    let page = 1; // Integer
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getOverpayments(xeroTenantId, ifModifiedSince, where, order, page, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element
page
Integer
e.g. page=1 – Up to 100 overpayments will be returned in a single API call with line items shown for each overpayment
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

getPayment

Retrieves a specific payment for invoices and credit notes using a unique payment Id


/Payments/{PaymentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Payments/{PaymentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID paymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Payments result = apiInstance.getPayment(accessToken, xeroTenantId, paymentID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPayment");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID paymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Payment
        try {
            Payments result = apiInstance.getPayment(xeroTenantId, paymentID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPayment");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *paymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Payment (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific payment for invoices and credit notes using a unique payment Id
[apiInstance getPaymentWith:xeroTenantId
    paymentID:paymentID
              completionHandler: ^(Payments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const paymentID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getPayment(xeroTenantId, paymentID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetPaymentExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var paymentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetPaymentAsync(accessToken, xeroTenantId, paymentID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetPayment: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$paymentID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getPayment($xeroTenantId, $paymentID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPayment: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $paymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Payment

eval { 
    my $result = $api_instance->getPayment(xeroTenantId => $xeroTenantId, paymentID => $paymentID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPayment: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_payment():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    payment_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_payment(xero_tenant_id, payment_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPayment: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let paymentID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getPayment(xeroTenantId, paymentID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
PaymentID*
UUID (uuid)
Unique identifier for a Payment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getPaymentHistory

Retrieves history records of a specific payment


/Payments/{PaymentID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Payments/{PaymentID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID paymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getPaymentHistory(accessToken, xeroTenantId, paymentID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPaymentHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID paymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Payment
        try {
            HistoryRecords result = apiInstance.getPaymentHistory(xeroTenantId, paymentID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPaymentHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *paymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Payment (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history records of a specific payment
[apiInstance getPaymentHistoryWith:xeroTenantId
    paymentID:paymentID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const paymentID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getPaymentHistory(xeroTenantId, paymentID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetPaymentHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var paymentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetPaymentHistoryAsync(accessToken, xeroTenantId, paymentID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetPaymentHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$paymentID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getPaymentHistory($xeroTenantId, $paymentID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPaymentHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $paymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Payment

eval { 
    my $result = $api_instance->getPaymentHistory(xeroTenantId => $xeroTenantId, paymentID => $paymentID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPaymentHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_payment_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    payment_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_payment_history(xero_tenant_id, payment_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPaymentHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let paymentID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getPaymentHistory(xeroTenantId, paymentID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
PaymentID*
UUID (uuid)
Unique identifier for a Payment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getPaymentServices

Retrieves payment services


/PaymentServices

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PaymentServices"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';

        try {
            PaymentServices result = apiInstance.getPaymentServices(accessToken, xeroTenantId);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPaymentServices");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        try {
            PaymentServices result = apiInstance.getPaymentServices(xeroTenantId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPaymentServices");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves payment services
[apiInstance getPaymentServicesWith:xeroTenantId
              completionHandler: ^(PaymentServices output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';

try {
  const response = await xero.accountingApi.getPaymentServices(xeroTenantId);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetPaymentServicesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            
            try {
                var result = await apiInstance.GetPaymentServicesAsync(accessToken, xeroTenantId);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetPaymentServices: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

try {
  $result = $apiInstance->getPaymentServices($xeroTenantId);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPaymentServices: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant

eval { 
    my $result = $api_instance->getPaymentServices(xeroTenantId => $xeroTenantId);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPaymentServices: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_payment_services():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    
    try:
        api_response = api_instance.get_payment_services(xero_tenant_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPaymentServices: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getPaymentServices(xeroTenantId, &context).wait();
    println!("{:?}", result);

}

Scopes

paymentservices Grant read-write access to payment services

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getPayments

Retrieves payments for invoices and credit notes


/Payments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Payments?where=Status=="AUTHORISED"&order=Amount ASC&page=1"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';

        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = 'Status=="AUTHORISED"';
        String order = 'Amount ASC';
        Integer page = 1;

        try {
            Payments result = apiInstance.getPayments(accessToken, xeroTenantId, ifModifiedSince, where, order, page);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPayments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = Status=="AUTHORISED"; // String | Filter by an any element
        String order = Amount ASC; // String | Order by an any element
        Integer page = 1; // Integer | Up to 100 payments will be returned in a single API call
        try {
            Payments result = apiInstance.getPayments(xeroTenantId, ifModifiedSince, where, order, page);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPayments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = Status=="AUTHORISED"; // Filter by an any element (optional) (default to null)
String *order = Amount ASC; // Order by an any element (optional) (default to null)
Integer *page = 1; // Up to 100 payments will be returned in a single API call (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves payments for invoices and credit notes
[apiInstance getPaymentsWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
    page:page
              completionHandler: ^(Payments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="AUTHORISED"';
const order = 'Amount ASC';
const page = 1;

try {
  const response = await xero.accountingApi.getPayments(xeroTenantId, ifModifiedSince, where, order, page);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetPaymentsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var ifModifiedSince = DateTime.Parse("2020-02-06T12:17:43.202-08:00");
            var where = "Status==\"AUTHORISED\"";
            var order = "Amount ASC";
            var page = 1;
            
            try {
                var result = await apiInstance.GetPaymentsAsync(accessToken, xeroTenantId, ifModifiedSince, where, order, page);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetPayments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\Payment::STATUS_AUTHORISED . '"";
$order = "Amount ASC";
$page = 1;

try {
  $result = $apiInstance->getPayments($xeroTenantId, $ifModifiedSince, $where, $order, $page);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPayments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = Status=="AUTHORISED"; # String | Filter by an any element
my $order = Amount ASC; # String | Order by an any element
my $page = 1; # Integer | Up to 100 payments will be returned in a single API call

eval { 
    my $result = $api_instance->getPayments(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order, page => $page);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPayments: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_payments():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    if_modified_since = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="AUTHORISED"'
    order = 'Amount ASC'
    
    try:
        api_response = api_instance.get_payments(xero_tenant_id, if_modified_since, where, order, page)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPayments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = Status=="AUTHORISED"; // String
    let order = Amount ASC; // String
    let page = 1; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getPayments(xeroTenantId, ifModifiedSince, where, order, page, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element
page
Integer
Up to 100 payments will be returned in a single API call

getPrepayment

Allows you to retrieve a specified prepayments


/Prepayments/{PrepaymentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Prepayments/{PrepaymentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID prepaymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Prepayments result = apiInstance.getPrepayment(accessToken, xeroTenantId, prepaymentID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPrepayment");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID prepaymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a PrePayment
        try {
            Prepayments result = apiInstance.getPrepayment(xeroTenantId, prepaymentID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPrepayment");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *prepaymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a PrePayment (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Allows you to retrieve a specified prepayments
[apiInstance getPrepaymentWith:xeroTenantId
    prepaymentID:prepaymentID
              completionHandler: ^(Prepayments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const prepaymentID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getPrepayment(xeroTenantId, prepaymentID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetPrepaymentExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var prepaymentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetPrepaymentAsync(accessToken, xeroTenantId, prepaymentID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetPrepayment: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$prepaymentID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getPrepayment($xeroTenantId, $prepaymentID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPrepayment: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $prepaymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a PrePayment

eval { 
    my $result = $api_instance->getPrepayment(xeroTenantId => $xeroTenantId, prepaymentID => $prepaymentID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPrepayment: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_prepayment():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    prepayment_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_prepayment(xero_tenant_id, prepayment_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPrepayment: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let prepaymentID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getPrepayment(xeroTenantId, prepaymentID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
PrepaymentID*
UUID (uuid)
Unique identifier for a PrePayment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getPrepaymentHistory

Retrieves history record for a specific prepayment


/Prepayments/{PrepaymentID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Prepayments/{PrepaymentID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID prepaymentID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getPrepaymentHistory(accessToken, xeroTenantId, prepaymentID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPrepaymentHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID prepaymentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a PrePayment
        try {
            HistoryRecords result = apiInstance.getPrepaymentHistory(xeroTenantId, prepaymentID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPrepaymentHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *prepaymentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a PrePayment (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history record for a specific prepayment
[apiInstance getPrepaymentHistoryWith:xeroTenantId
    prepaymentID:prepaymentID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const prepaymentID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getPrepaymentHistory(xeroTenantId, prepaymentID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetPrepaymentHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var prepaymentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetPrepaymentHistoryAsync(accessToken, xeroTenantId, prepaymentID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetPrepaymentHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$prepaymentID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getPrepaymentHistory($xeroTenantId, $prepaymentID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPrepaymentHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $prepaymentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a PrePayment

eval { 
    my $result = $api_instance->getPrepaymentHistory(xeroTenantId => $xeroTenantId, prepaymentID => $prepaymentID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPrepaymentHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_prepayment_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    prepayment_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_prepayment_history(xero_tenant_id, prepayment_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPrepaymentHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let prepaymentID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getPrepaymentHistory(xeroTenantId, prepaymentID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
PrepaymentID*
UUID (uuid)
Unique identifier for a PrePayment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getPrepayments

Retrieves prepayments


/Prepayments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Prepayments?where=Status=="AUTHORISED"&order=Reference ASC&page=1&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';

        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = 'Status=="AUTHORISED"';
        String order = 'Reference ASC';
        Integer page = 1;
        Integer unitdp = 4;

        try {
            Prepayments result = apiInstance.getPrepayments(accessToken, xeroTenantId, ifModifiedSince, where, order, page, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPrepayments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = Status=="AUTHORISED"; // String | Filter by an any element
        String order = Reference ASC; // String | Order by an any element
        Integer page = 1; // Integer | e.g. page=1 – Up to 100 prepayments will be returned in a single API call with line items shown for each overpayment
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Prepayments result = apiInstance.getPrepayments(xeroTenantId, ifModifiedSince, where, order, page, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPrepayments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = Status=="AUTHORISED"; // Filter by an any element (optional) (default to null)
String *order = Reference ASC; // Order by an any element (optional) (default to null)
Integer *page = 1; // e.g. page=1 – Up to 100 prepayments will be returned in a single API call with line items shown for each overpayment (optional) (default to null)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves prepayments
[apiInstance getPrepaymentsWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
    page:page
    unitdp:unitdp
              completionHandler: ^(Prepayments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="AUTHORISED"';
const order = 'Reference ASC';
const page = 1;
const unitdp = 4;

try {
  const response = await xero.accountingApi.getPrepayments(xeroTenantId, ifModifiedSince, where, order, page, unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetPrepaymentsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var ifModifiedSince = DateTime.Parse("2020-02-06T12:17:43.202-08:00");
            var where = "Status==\"AUTHORISED\"";
            var order = "Reference ASC";
            var page = 1;
            var unitdp = 4;
            
            try {
                var result = await apiInstance.GetPrepaymentsAsync(accessToken, xeroTenantId, ifModifiedSince, where, order, page, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetPrepayments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\Prepayment::STATUS_AUTHORISED . '"";
$order = "Reference ASC";
$page = 1;
$unitdp = 4;

try {
  $result = $apiInstance->getPrepayments($xeroTenantId, $ifModifiedSince, $where, $order, $page, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPrepayments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = Status=="AUTHORISED"; # String | Filter by an any element
my $order = Reference ASC; # String | Order by an any element
my $page = 1; # Integer | e.g. page=1 – Up to 100 prepayments will be returned in a single API call with line items shown for each overpayment
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->getPrepayments(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order, page => $page, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPrepayments: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_prepayments():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    if_modified_since = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="AUTHORISED"'
    order = 'Reference ASC'
    
    try:
        api_response = api_instance.get_prepayments(xero_tenant_id, if_modified_since, where, order, page, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPrepayments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = Status=="AUTHORISED"; // String
    let order = Reference ASC; // String
    let page = 1; // Integer
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getPrepayments(xeroTenantId, ifModifiedSince, where, order, page, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element
page
Integer
e.g. page=1 – Up to 100 prepayments will be returned in a single API call with line items shown for each overpayment
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

getPurchaseOrder

Retrieves a specific purchase order using a unique purchase order Id


/PurchaseOrders/{PurchaseOrderID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders/{PurchaseOrderID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID purchaseOrderID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            PurchaseOrders result = apiInstance.getPurchaseOrder(accessToken, xeroTenantId, purchaseOrderID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrder");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Purchase Order
        try {
            PurchaseOrders result = apiInstance.getPurchaseOrder(xeroTenantId, purchaseOrderID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrder");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *purchaseOrderID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Purchase Order (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific purchase order using a unique purchase order Id
[apiInstance getPurchaseOrderWith:xeroTenantId
    purchaseOrderID:purchaseOrderID
              completionHandler: ^(PurchaseOrders output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const purchaseOrderID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getPurchaseOrder(xeroTenantId, purchaseOrderID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetPurchaseOrderExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var purchaseOrderID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetPurchaseOrderAsync(accessToken, xeroTenantId, purchaseOrderID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetPurchaseOrder: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$purchaseOrderID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getPurchaseOrder($xeroTenantId, $purchaseOrderID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPurchaseOrder: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrderID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Purchase Order

eval { 
    my $result = $api_instance->getPurchaseOrder(xeroTenantId => $xeroTenantId, purchaseOrderID => $purchaseOrderID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPurchaseOrder: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_purchase_order():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    purchase_order_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_purchase_order(xero_tenant_id, purchase_order_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPurchaseOrder: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getPurchaseOrder(xeroTenantId, purchaseOrderID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
PurchaseOrderID*
UUID (uuid)
Unique identifier for an Purchase Order
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getPurchaseOrderAsPdf

Retrieves specific purchase order as PDF files using a unique purchase order Id


/PurchaseOrders/{PurchaseOrderID}/pdf

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders/{PurchaseOrderID}/pdf"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID purchaseOrderID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            ByteArrayInputStream result = apiInstance.getPurchaseOrderAsPdf(accessToken, xeroTenantId, purchaseOrderID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrderAsPdf");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Purchase Order
        try {
            File result = apiInstance.getPurchaseOrderAsPdf(xeroTenantId, purchaseOrderID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrderAsPdf");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *purchaseOrderID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Purchase Order (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves specific purchase order as PDF files using a unique purchase order Id
[apiInstance getPurchaseOrderAsPdfWith:xeroTenantId
    purchaseOrderID:purchaseOrderID
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const purchaseOrderID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getPurchaseOrderAsPdf(xeroTenantId, purchaseOrderID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetPurchaseOrderAsPdfExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var purchaseOrderID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetPurchaseOrderAsPdfAsync(accessToken, xeroTenantId, purchaseOrderID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetPurchaseOrderAsPdf: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$purchaseOrderID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getPurchaseOrderAsPdf($xeroTenantId, $purchaseOrderID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPurchaseOrderAsPdf: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrderID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Purchase Order

eval { 
    my $result = $api_instance->getPurchaseOrderAsPdf(xeroTenantId => $xeroTenantId, purchaseOrderID => $purchaseOrderID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPurchaseOrderAsPdf: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_purchase_order_as_pdf():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    purchase_order_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_purchase_order_as_pdf(xero_tenant_id, purchase_order_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPurchaseOrderAsPdf: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getPurchaseOrderAsPdf(xeroTenantId, purchaseOrderID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
PurchaseOrderID*
UUID (uuid)
Unique identifier for an Purchase Order
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getPurchaseOrderAttachmentById

Retrieves specific attachment for a specific purchase order using a unique attachment Id


/PurchaseOrders/{PurchaseOrderID}/Attachments/{AttachmentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders/{PurchaseOrderID}/Attachments/{AttachmentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID purchaseOrderID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID attachmentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String contentType = 'image/jpg';

        try {
            ByteArrayInputStream result = apiInstance.getPurchaseOrderAttachmentById(accessToken, xeroTenantId, purchaseOrderID, attachmentID, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrderAttachmentById");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Purchase Order
        UUID attachmentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Attachment object
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getPurchaseOrderAttachmentById(xeroTenantId, purchaseOrderID, attachmentID, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrderAttachmentById");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *purchaseOrderID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Purchase Order (default to null)
UUID *attachmentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Attachment object (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves specific attachment for a specific purchase order using a unique attachment Id
[apiInstance getPurchaseOrderAttachmentByIdWith:xeroTenantId
    purchaseOrderID:purchaseOrderID
    attachmentID:attachmentID
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const purchaseOrderID = '00000000-0000-0000-0000-000000000000';
const attachmentID = '00000000-0000-0000-0000-000000000000';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getPurchaseOrderAttachmentById(xeroTenantId, purchaseOrderID, attachmentID, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetPurchaseOrderAttachmentByIdExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var purchaseOrderID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var attachmentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetPurchaseOrderAttachmentByIdAsync(accessToken, xeroTenantId, purchaseOrderID, attachmentID, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetPurchaseOrderAttachmentById: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$purchaseOrderID = "00000000-0000-0000-0000-000000000000";
$attachmentID = "00000000-0000-0000-0000-000000000000";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getPurchaseOrderAttachmentById($xeroTenantId, $purchaseOrderID, $attachmentID, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPurchaseOrderAttachmentById: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrderID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Purchase Order
my $attachmentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Attachment object
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getPurchaseOrderAttachmentById(xeroTenantId => $xeroTenantId, purchaseOrderID => $purchaseOrderID, attachmentID => $attachmentID, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPurchaseOrderAttachmentById: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_purchase_order_attachment_by_id():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    purchase_order_id = '00000000-0000-0000-0000-000000000000'
    attachment_id = '00000000-0000-0000-0000-000000000000'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_purchase_order_attachment_by_id(xero_tenant_id, purchase_order_id, attachment_id, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPurchaseOrderAttachmentById: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID
    let attachmentID = 00000000-0000-0000-0000-000000000000; // UUID
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getPurchaseOrderAttachmentById(xeroTenantId, purchaseOrderID, attachmentID, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
PurchaseOrderID*
UUID (uuid)
Unique identifier for an Purchase Order
Required
AttachmentID*
UUID (uuid)
Unique identifier for Attachment object
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getPurchaseOrderAttachments

Retrieves attachments for a specific purchase order


/PurchaseOrders/{PurchaseOrderID}/Attachments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders/{PurchaseOrderID}/Attachments"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID purchaseOrderID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Attachments result = apiInstance.getPurchaseOrderAttachments(accessToken, xeroTenantId, purchaseOrderID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrderAttachments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Purchase Order
        try {
            Attachments result = apiInstance.getPurchaseOrderAttachments(xeroTenantId, purchaseOrderID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrderAttachments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *purchaseOrderID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Purchase Order (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves attachments for a specific purchase order
[apiInstance getPurchaseOrderAttachmentsWith:xeroTenantId
    purchaseOrderID:purchaseOrderID
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const purchaseOrderID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getPurchaseOrderAttachments(xeroTenantId, purchaseOrderID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetPurchaseOrderAttachmentsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var purchaseOrderID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetPurchaseOrderAttachmentsAsync(accessToken, xeroTenantId, purchaseOrderID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetPurchaseOrderAttachments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$purchaseOrderID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getPurchaseOrderAttachments($xeroTenantId, $purchaseOrderID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPurchaseOrderAttachments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrderID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Purchase Order

eval { 
    my $result = $api_instance->getPurchaseOrderAttachments(xeroTenantId => $xeroTenantId, purchaseOrderID => $purchaseOrderID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPurchaseOrderAttachments: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_purchase_order_attachments():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    purchase_order_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_purchase_order_attachments(xero_tenant_id, purchase_order_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPurchaseOrderAttachments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getPurchaseOrderAttachments(xeroTenantId, purchaseOrderID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
PurchaseOrderID*
UUID (uuid)
Unique identifier for an Purchase Order
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getPurchaseOrderByNumber

Retrieves a specific purchase order using purchase order number


/PurchaseOrders/{PurchaseOrderNumber}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders/{PurchaseOrderNumber}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        String purchaseOrderNumber = 'PO1234';

        try {
            PurchaseOrders result = apiInstance.getPurchaseOrderByNumber(accessToken, xeroTenantId, purchaseOrderNumber);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrderByNumber");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        String purchaseOrderNumber = PO1234; // String | Unique identifier for a PurchaseOrder
        try {
            PurchaseOrders result = apiInstance.getPurchaseOrderByNumber(xeroTenantId, purchaseOrderNumber);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrderByNumber");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
String *purchaseOrderNumber = PO1234; // Unique identifier for a PurchaseOrder (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific purchase order using purchase order number
[apiInstance getPurchaseOrderByNumberWith:xeroTenantId
    purchaseOrderNumber:purchaseOrderNumber
              completionHandler: ^(PurchaseOrders output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const purchaseOrderNumber = 'PO1234';

try {
  const response = await xero.accountingApi.getPurchaseOrderByNumber(xeroTenantId, purchaseOrderNumber);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetPurchaseOrderByNumberExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var purchaseOrderNumber = "PO1234";
            
            try {
                var result = await apiInstance.GetPurchaseOrderByNumberAsync(accessToken, xeroTenantId, purchaseOrderNumber);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetPurchaseOrderByNumber: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$purchaseOrderNumber = "PO1234";

try {
  $result = $apiInstance->getPurchaseOrderByNumber($xeroTenantId, $purchaseOrderNumber);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPurchaseOrderByNumber: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrderNumber = PO1234; # String | Unique identifier for a PurchaseOrder

eval { 
    my $result = $api_instance->getPurchaseOrderByNumber(xeroTenantId => $xeroTenantId, purchaseOrderNumber => $purchaseOrderNumber);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPurchaseOrderByNumber: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_purchase_order_by_number():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    purchase_order_number = 'PO1234'
    
    try:
        api_response = api_instance.get_purchase_order_by_number(xero_tenant_id, purchase_order_number)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPurchaseOrderByNumber: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrderNumber = PO1234; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getPurchaseOrderByNumber(xeroTenantId, purchaseOrderNumber, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
PurchaseOrderNumber*
String
Unique identifier for a PurchaseOrder
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getPurchaseOrderHistory

Retrieves history for a specific purchase order


/PurchaseOrders/{PurchaseOrderID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders/{PurchaseOrderID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID purchaseOrderID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getPurchaseOrderHistory(accessToken, xeroTenantId, purchaseOrderID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrderHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Purchase Order
        try {
            HistoryRecords result = apiInstance.getPurchaseOrderHistory(xeroTenantId, purchaseOrderID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrderHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *purchaseOrderID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Purchase Order (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history for a specific purchase order
[apiInstance getPurchaseOrderHistoryWith:xeroTenantId
    purchaseOrderID:purchaseOrderID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const purchaseOrderID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getPurchaseOrderHistory(xeroTenantId, purchaseOrderID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetPurchaseOrderHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var purchaseOrderID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetPurchaseOrderHistoryAsync(accessToken, xeroTenantId, purchaseOrderID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetPurchaseOrderHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$purchaseOrderID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getPurchaseOrderHistory($xeroTenantId, $purchaseOrderID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPurchaseOrderHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrderID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Purchase Order

eval { 
    my $result = $api_instance->getPurchaseOrderHistory(xeroTenantId => $xeroTenantId, purchaseOrderID => $purchaseOrderID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPurchaseOrderHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_purchase_order_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    purchase_order_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_purchase_order_history(xero_tenant_id, purchase_order_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPurchaseOrderHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getPurchaseOrderHistory(xeroTenantId, purchaseOrderID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
PurchaseOrderID*
UUID (uuid)
Unique identifier for an Purchase Order
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getPurchaseOrders

Retrieves purchase orders


/PurchaseOrders

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders?Status=SUBMITTED&DateFrom=2019-12-01&DateTo=2019-12-31&order=PurchaseOrderNumber ASC&page=1"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';

        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String status = 'SUBMITTED';
        String dateFrom = '2019-12-01';
        String dateTo = '2019-12-31';
        String order = 'PurchaseOrderNumber ASC';
        Integer page = 1;

        try {
            PurchaseOrders result = apiInstance.getPurchaseOrders(accessToken, xeroTenantId, ifModifiedSince, status, dateFrom, dateTo, order, page);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrders");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String status = SUBMITTED; // String | Filter by purchase order status
        String dateFrom = 2019-12-01; // String | Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31
        String dateTo = 2019-12-31; // String | Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31
        String order = PurchaseOrderNumber ASC; // String | Order by an any element
        Integer page = 1; // Integer | To specify a page, append the page parameter to the URL e.g. ?page=1. If there are 100 records in the response you will need to check if there is any more data by fetching the next page e.g ?page=2 and continuing this process until no more results are returned.
        try {
            PurchaseOrders result = apiInstance.getPurchaseOrders(xeroTenantId, ifModifiedSince, status, dateFrom, dateTo, order, page);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrders");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *status = SUBMITTED; // Filter by purchase order status (optional) (default to null)
String *dateFrom = 2019-12-01; // Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31 (optional) (default to null)
String *dateTo = 2019-12-31; // Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31 (optional) (default to null)
String *order = PurchaseOrderNumber ASC; // Order by an any element (optional) (default to null)
Integer *page = 1; // To specify a page, append the page parameter to the URL e.g. ?page=1. If there are 100 records in the response you will need to check if there is any more data by fetching the next page e.g ?page=2 and continuing this process until no more results are returned. (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves purchase orders
[apiInstance getPurchaseOrdersWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    status:status
    dateFrom:dateFrom
    dateTo:dateTo
    order:order
    page:page
              completionHandler: ^(PurchaseOrders output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const status = 'SUBMITTED';
const dateFrom = '2019-12-01';
const dateTo = '2019-12-31';
const order = 'PurchaseOrderNumber ASC';
const page = 1;

try {
  const response = await xero.accountingApi.getPurchaseOrders(xeroTenantId, ifModifiedSince, status, dateFrom, dateTo, order, page);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetPurchaseOrdersExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var ifModifiedSince = DateTime.Parse("2020-02-06T12:17:43.202-08:00");
            var status = "SUBMITTED";
            var dateFrom = "2019-12-01";
            var dateTo = "2019-12-31";
            var order = "PurchaseOrderNumber ASC";
            var page = 1;
            
            try {
                var result = await apiInstance.GetPurchaseOrdersAsync(accessToken, xeroTenantId, ifModifiedSince, status, dateFrom, dateTo, order, page);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetPurchaseOrders: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$status = "SUBMITTED";
$dateFrom = "2019-12-01";
$dateTo = "2019-12-31";
$order = "PurchaseOrderNumber ASC";
$page = 1;

try {
  $result = $apiInstance->getPurchaseOrders($xeroTenantId, $ifModifiedSince, $status, $dateFrom, $dateTo, $order, $page);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPurchaseOrders: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $status = SUBMITTED; # String | Filter by purchase order status
my $dateFrom = 2019-12-01; # String | Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31
my $dateTo = 2019-12-31; # String | Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31
my $order = PurchaseOrderNumber ASC; # String | Order by an any element
my $page = 1; # Integer | To specify a page, append the page parameter to the URL e.g. ?page=1. If there are 100 records in the response you will need to check if there is any more data by fetching the next page e.g ?page=2 and continuing this process until no more results are returned.

eval { 
    my $result = $api_instance->getPurchaseOrders(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, status => $status, dateFrom => $dateFrom, dateTo => $dateTo, order => $order, page => $page);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPurchaseOrders: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_purchase_orders():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    if_modified_since = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    status = 'SUBMITTED'
    dateFrom = '2019-12-01'
    dateTo = '2019-12-31'
    order = 'PurchaseOrderNumber ASC'
    
    try:
        api_response = api_instance.get_purchase_orders(xero_tenant_id, if_modified_since, status, dateFrom, dateTo, order, page)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPurchaseOrders: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let status = SUBMITTED; // String
    let dateFrom = 2019-12-01; // String
    let dateTo = 2019-12-31; // String
    let order = PurchaseOrderNumber ASC; // String
    let page = 1; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getPurchaseOrders(xeroTenantId, ifModifiedSince, status, dateFrom, dateTo, order, page, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
Status
String
Filter by purchase order status
DateFrom
String
Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31
DateTo
String
Filter by purchase order date (e.g. GET https://.../PurchaseOrders?DateFrom=2015-12-01&DateTo=2015-12-31
order
String
Order by an any element
page
Integer
To specify a page, append the page parameter to the URL e.g. ?page=1. If there are 100 records in the response you will need to check if there is any more data by fetching the next page e.g ?page=2 and continuing this process until no more results are returned.

getPurchaseOrder≠AttachmentByFileName

Retrieves a specific attachment for a specific purchase order by filename


/PurchaseOrders/{PurchaseOrderID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders/{PurchaseOrderID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID purchaseOrderID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        String contentType = 'image/jpg';

        try {
            ByteArrayInputStream result = apiInstance.getPurchaseOrder≠AttachmentByFileName(accessToken, xeroTenantId, purchaseOrderID, fileName, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrder≠AttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Purchase Order
        String fileName = xero-dev.jpg; // String | Name of the attachment
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getPurchaseOrder≠AttachmentByFileName(xeroTenantId, purchaseOrderID, fileName, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getPurchaseOrder≠AttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *purchaseOrderID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Purchase Order (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment for a specific purchase order by filename
[apiInstance getPurchaseOrder≠AttachmentByFileNameWith:xeroTenantId
    purchaseOrderID:purchaseOrderID
    fileName:fileName
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const purchaseOrderID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getPurchaseOrder≠AttachmentByFileName(xeroTenantId, purchaseOrderID, fileName, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetPurchaseOrder≠AttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var purchaseOrderID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetPurchaseOrder≠AttachmentByFileNameAsync(accessToken, xeroTenantId, purchaseOrderID, fileName, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetPurchaseOrder≠AttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$purchaseOrderID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getPurchaseOrder≠AttachmentByFileName($xeroTenantId, $purchaseOrderID, $fileName, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getPurchaseOrder≠AttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrderID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Purchase Order
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getPurchaseOrder≠AttachmentByFileName(xeroTenantId => $xeroTenantId, purchaseOrderID => $purchaseOrderID, fileName => $fileName, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getPurchaseOrder≠AttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_purchase_order≠attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    purchase_order_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_purchase_order≠attachment_by_file_name(xero_tenant_id, purchase_order_id, file_name, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getPurchaseOrder≠AttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getPurchaseOrder≠AttachmentByFileName(xeroTenantId, purchaseOrderID, fileName, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
PurchaseOrderID*
UUID (uuid)
Unique identifier for an Purchase Order
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getQuote

Retrieves a specific quote using a unique quote Id


/Quotes/{QuoteID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes/{QuoteID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID quoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Quotes result = apiInstance.getQuote(accessToken, xeroTenantId, quoteID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getQuote");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID quoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Quote
        try {
            Quotes result = apiInstance.getQuote(xeroTenantId, quoteID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getQuote");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *quoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Quote (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific quote using a unique quote Id
[apiInstance getQuoteWith:xeroTenantId
    quoteID:quoteID
              completionHandler: ^(Quotes output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const quoteID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getQuote(xeroTenantId, quoteID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetQuoteExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var quoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetQuoteAsync(accessToken, xeroTenantId, quoteID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetQuote: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$quoteID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getQuote($xeroTenantId, $quoteID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getQuote: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $quoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Quote

eval { 
    my $result = $api_instance->getQuote(xeroTenantId => $xeroTenantId, quoteID => $quoteID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getQuote: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_quote():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    quote_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_quote(xero_tenant_id, quote_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getQuote: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let quoteID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getQuote(xeroTenantId, quoteID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
QuoteID*
UUID (uuid)
Unique identifier for an Quote
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getQuoteAsPdf

Retrieves a specific quote as a PDF file using a unique quote Id


/Quotes/{QuoteID}/pdf

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes/{QuoteID}/pdf"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID quoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            ByteArrayInputStream result = apiInstance.getQuoteAsPdf(accessToken, xeroTenantId, quoteID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getQuoteAsPdf");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID quoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Quote
        try {
            File result = apiInstance.getQuoteAsPdf(xeroTenantId, quoteID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getQuoteAsPdf");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *quoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Quote (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific quote as a PDF file using a unique quote Id
[apiInstance getQuoteAsPdfWith:xeroTenantId
    quoteID:quoteID
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const quoteID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getQuoteAsPdf(xeroTenantId, quoteID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetQuoteAsPdfExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var quoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetQuoteAsPdfAsync(accessToken, xeroTenantId, quoteID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetQuoteAsPdf: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$quoteID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getQuoteAsPdf($xeroTenantId, $quoteID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getQuoteAsPdf: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $quoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Quote

eval { 
    my $result = $api_instance->getQuoteAsPdf(xeroTenantId => $xeroTenantId, quoteID => $quoteID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getQuoteAsPdf: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_quote_as_pdf():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    quote_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_quote_as_pdf(xero_tenant_id, quote_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getQuoteAsPdf: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let quoteID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getQuoteAsPdf(xeroTenantId, quoteID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
QuoteID*
UUID (uuid)
Unique identifier for an Quote
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getQuoteAttachmentByFileName

Retrieves a specific attachment from a specific quote by filename


/Quotes/{QuoteID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes/{QuoteID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID quoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        String contentType = 'image/jpg';

        try {
            ByteArrayInputStream result = apiInstance.getQuoteAttachmentByFileName(accessToken, xeroTenantId, quoteID, fileName, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getQuoteAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID quoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Quote
        String fileName = xero-dev.jpg; // String | Name of the attachment
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getQuoteAttachmentByFileName(xeroTenantId, quoteID, fileName, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getQuoteAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *quoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Quote (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific quote by filename
[apiInstance getQuoteAttachmentByFileNameWith:xeroTenantId
    quoteID:quoteID
    fileName:fileName
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const quoteID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getQuoteAttachmentByFileName(xeroTenantId, quoteID, fileName, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetQuoteAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var quoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetQuoteAttachmentByFileNameAsync(accessToken, xeroTenantId, quoteID, fileName, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetQuoteAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$quoteID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getQuoteAttachmentByFileName($xeroTenantId, $quoteID, $fileName, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getQuoteAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $quoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Quote
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getQuoteAttachmentByFileName(xeroTenantId => $xeroTenantId, quoteID => $quoteID, fileName => $fileName, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getQuoteAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_quote_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    quote_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_quote_attachment_by_file_name(xero_tenant_id, quote_id, file_name, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getQuoteAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let quoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getQuoteAttachmentByFileName(xeroTenantId, quoteID, fileName, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
QuoteID*
UUID (uuid)
Unique identifier for an Quote
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getQuoteAttachmentById

Retrieves a specific attachment from a specific quote using a unique attachment Id


/Quotes/{QuoteID}/Attachments/{AttachmentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes/{QuoteID}/Attachments/{AttachmentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID quoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID attachmentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String contentType = 'image/jpg';

        try {
            ByteArrayInputStream result = apiInstance.getQuoteAttachmentById(accessToken, xeroTenantId, quoteID, attachmentID, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getQuoteAttachmentById");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID quoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Quote
        UUID attachmentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Attachment object
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getQuoteAttachmentById(xeroTenantId, quoteID, attachmentID, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getQuoteAttachmentById");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *quoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Quote (default to null)
UUID *attachmentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Attachment object (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific quote using a unique attachment Id
[apiInstance getQuoteAttachmentByIdWith:xeroTenantId
    quoteID:quoteID
    attachmentID:attachmentID
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const quoteID = '00000000-0000-0000-0000-000000000000';
const attachmentID = '00000000-0000-0000-0000-000000000000';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getQuoteAttachmentById(xeroTenantId, quoteID, attachmentID, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetQuoteAttachmentByIdExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var quoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var attachmentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetQuoteAttachmentByIdAsync(accessToken, xeroTenantId, quoteID, attachmentID, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetQuoteAttachmentById: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$quoteID = "00000000-0000-0000-0000-000000000000";
$attachmentID = "00000000-0000-0000-0000-000000000000";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getQuoteAttachmentById($xeroTenantId, $quoteID, $attachmentID, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getQuoteAttachmentById: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $quoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Quote
my $attachmentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Attachment object
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getQuoteAttachmentById(xeroTenantId => $xeroTenantId, quoteID => $quoteID, attachmentID => $attachmentID, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getQuoteAttachmentById: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_quote_attachment_by_id():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    quote_id = '00000000-0000-0000-0000-000000000000'
    attachment_id = '00000000-0000-0000-0000-000000000000'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_quote_attachment_by_id(xero_tenant_id, quote_id, attachment_id, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getQuoteAttachmentById: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let quoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let attachmentID = 00000000-0000-0000-0000-000000000000; // UUID
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getQuoteAttachmentById(xeroTenantId, quoteID, attachmentID, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
QuoteID*
UUID (uuid)
Unique identifier for an Quote
Required
AttachmentID*
UUID (uuid)
Unique identifier for Attachment object
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getQuoteAttachments

Retrieves attachments for a specific quote


/Quotes/{QuoteID}/Attachments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes/{QuoteID}/Attachments"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID quoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Attachments result = apiInstance.getQuoteAttachments(accessToken, xeroTenantId, quoteID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getQuoteAttachments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID quoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Quote
        try {
            Attachments result = apiInstance.getQuoteAttachments(xeroTenantId, quoteID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getQuoteAttachments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *quoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Quote (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves attachments for a specific quote
[apiInstance getQuoteAttachmentsWith:xeroTenantId
    quoteID:quoteID
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const quoteID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getQuoteAttachments(xeroTenantId, quoteID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetQuoteAttachmentsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var quoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetQuoteAttachmentsAsync(accessToken, xeroTenantId, quoteID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetQuoteAttachments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$quoteID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getQuoteAttachments($xeroTenantId, $quoteID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getQuoteAttachments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $quoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Quote

eval { 
    my $result = $api_instance->getQuoteAttachments(xeroTenantId => $xeroTenantId, quoteID => $quoteID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getQuoteAttachments: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_quote_attachments():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    quote_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_quote_attachments(xero_tenant_id, quote_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getQuoteAttachments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let quoteID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getQuoteAttachments(xeroTenantId, quoteID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
QuoteID*
UUID (uuid)
Unique identifier for an Quote
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getQuoteHistory

Retrieves history records of a specific quote


/Quotes/{QuoteID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes/{QuoteID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID quoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getQuoteHistory(accessToken, xeroTenantId, quoteID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getQuoteHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID quoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Quote
        try {
            HistoryRecords result = apiInstance.getQuoteHistory(xeroTenantId, quoteID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getQuoteHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *quoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Quote (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history records of a specific quote
[apiInstance getQuoteHistoryWith:xeroTenantId
    quoteID:quoteID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const quoteID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getQuoteHistory(xeroTenantId, quoteID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetQuoteHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var quoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetQuoteHistoryAsync(accessToken, xeroTenantId, quoteID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetQuoteHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$quoteID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getQuoteHistory($xeroTenantId, $quoteID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getQuoteHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $quoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Quote

eval { 
    my $result = $api_instance->getQuoteHistory(xeroTenantId => $xeroTenantId, quoteID => $quoteID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getQuoteHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_quote_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    quote_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_quote_history(xero_tenant_id, quote_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getQuoteHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let quoteID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getQuoteHistory(xeroTenantId, quoteID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
QuoteID*
UUID (uuid)
Unique identifier for an Quote
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getQuotes

Retrieves sales quotes


/Quotes

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes?DateFrom=2013-10-20&DateTo=2013-10-20&ExpiryDateFrom=2013-10-20&ExpiryDateTo=2013-10-20&ContactID=00000000-0000-0000-0000-000000000000&Status=DRAFT&page=1&order=Status ASC&QuoteNumber=QU-0001"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';

        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        date dateFrom = 2013-10-20;
        date dateTo = 2013-10-20;
        date expiryDateFrom = 2013-10-20;
        date expiryDateTo = 2013-10-20;
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String status = 'DRAFT';
        Integer page = 1;
        String order = 'Status ASC';
        String quoteNumber = 'QU-0001';

        try {
            Quotes result = apiInstance.getQuotes(accessToken, xeroTenantId, ifModifiedSince, dateFrom, dateTo, expiryDateFrom, expiryDateTo, contactID, status, page, order, quoteNumber);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getQuotes");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        date dateFrom = 2013-10-20; // date | Filter for quotes after a particular date
        date dateTo = 2013-10-20; // date | Filter for quotes before a particular date
        date expiryDateFrom = 2013-10-20; // date | Filter for quotes expiring after a particular date
        date expiryDateTo = 2013-10-20; // date | Filter for quotes before a particular date
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Filter for quotes belonging to a particular contact
        String status = DRAFT; // String | Filter for quotes of a particular Status
        Integer page = 1; // Integer | e.g. page=1 – Up to 100 Quotes will be returned in a single API call with line items shown for each quote
        String order = Status ASC; // String | Order by an any element
        String quoteNumber = QU-0001; // String | Filter by quote number (e.g. GET https://.../Quotes?QuoteNumber=QU-0001)
        try {
            Quotes result = apiInstance.getQuotes(xeroTenantId, ifModifiedSince, dateFrom, dateTo, expiryDateFrom, expiryDateTo, contactID, status, page, order, quoteNumber);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getQuotes");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
date *dateFrom = 2013-10-20; // Filter for quotes after a particular date (optional) (default to null)
date *dateTo = 2013-10-20; // Filter for quotes before a particular date (optional) (default to null)
date *expiryDateFrom = 2013-10-20; // Filter for quotes expiring after a particular date (optional) (default to null)
date *expiryDateTo = 2013-10-20; // Filter for quotes before a particular date (optional) (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Filter for quotes belonging to a particular contact (optional) (default to null)
String *status = DRAFT; // Filter for quotes of a particular Status (optional) (default to null)
Integer *page = 1; // e.g. page=1 – Up to 100 Quotes will be returned in a single API call with line items shown for each quote (optional) (default to null)
String *order = Status ASC; // Order by an any element (optional) (default to null)
String *quoteNumber = QU-0001; // Filter by quote number (e.g. GET https://.../Quotes?QuoteNumber=QU-0001) (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves sales quotes
[apiInstance getQuotesWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    dateFrom:dateFrom
    dateTo:dateTo
    expiryDateFrom:expiryDateFrom
    expiryDateTo:expiryDateTo
    contactID:contactID
    status:status
    page:page
    order:order
    quoteNumber:quoteNumber
              completionHandler: ^(Quotes output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const dateFrom: Date = new Date("2013-10-20");
const dateTo: Date = new Date("2013-10-20");
const expiryDateFrom: Date = new Date("2013-10-20");
const expiryDateTo: Date = new Date("2013-10-20");
const contactID = '00000000-0000-0000-0000-000000000000';
const status = 'DRAFT';
const page = 1;
const order = 'Status ASC';
const quoteNumber = 'QU-0001';

try {
  const response = await xero.accountingApi.getQuotes(xeroTenantId, ifModifiedSince, dateFrom, dateTo, expiryDateFrom, expiryDateTo, contactID, status, page, order, quoteNumber);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetQuotesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var ifModifiedSince = DateTime.Parse("2020-02-06T12:17:43.202-08:00");
            var dateFrom = DateTime.Parse("2013-10-20");
            var dateTo = DateTime.Parse("2013-10-20");
            var expiryDateFrom = DateTime.Parse("2013-10-20");
            var expiryDateTo = DateTime.Parse("2013-10-20");
            var contactID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var status = "DRAFT";
            var page = 1;
            var order = "Status ASC";
            var quoteNumber = "QU-0001";
            
            try {
                var result = await apiInstance.GetQuotesAsync(accessToken, xeroTenantId, ifModifiedSince, dateFrom, dateTo, expiryDateFrom, expiryDateTo, contactID, status, page, order, quoteNumber);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetQuotes: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$dateFrom = new DateTime("2013-10-20");
$dateTo = new DateTime("2013-10-20");
$expiryDateFrom = new DateTime("2013-10-20");
$expiryDateTo = new DateTime("2013-10-20");
$contactID = "00000000-0000-0000-0000-000000000000";
$status = "DRAFT";
$page = 1;
$order = "Status ASC";
$quoteNumber = "QU-0001";

try {
  $result = $apiInstance->getQuotes($xeroTenantId, $ifModifiedSince, $dateFrom, $dateTo, $expiryDateFrom, $expiryDateTo, $contactID, $status, $page, $order, $quoteNumber);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getQuotes: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $dateFrom = 2013-10-20; # date | Filter for quotes after a particular date
my $dateTo = 2013-10-20; # date | Filter for quotes before a particular date
my $expiryDateFrom = 2013-10-20; # date | Filter for quotes expiring after a particular date
my $expiryDateTo = 2013-10-20; # date | Filter for quotes before a particular date
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Filter for quotes belonging to a particular contact
my $status = DRAFT; # String | Filter for quotes of a particular Status
my $page = 1; # Integer | e.g. page=1 – Up to 100 Quotes will be returned in a single API call with line items shown for each quote
my $order = Status ASC; # String | Order by an any element
my $quoteNumber = QU-0001; # String | Filter by quote number (e.g. GET https://.../Quotes?QuoteNumber=QU-0001)

eval { 
    my $result = $api_instance->getQuotes(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, dateFrom => $dateFrom, dateTo => $dateTo, expiryDateFrom => $expiryDateFrom, expiryDateTo => $expiryDateTo, contactID => $contactID, status => $status, page => $page, order => $order, quoteNumber => $quoteNumber);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getQuotes: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_quotes():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    if_modified_since = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    date_from = dateutil.parser.parse("2013-10-20")
    date_to = dateutil.parser.parse("2013-10-20")
    expiry_date_from = dateutil.parser.parse("2013-10-20")
    expiry_date_to = dateutil.parser.parse("2013-10-20")
    contact_id = '00000000-0000-0000-0000-000000000000'
    status = 'DRAFT'
    order = 'Status ASC'
    quote_number = 'QU-0001'
    
    try:
        api_response = api_instance.get_quotes(xero_tenant_id, if_modified_since, date_from, date_to, expiry_date_from, expiry_date_to, contact_id, status, page, order, quote_number)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getQuotes: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let dateFrom = 2013-10-20; // date
    let dateTo = 2013-10-20; // date
    let expiryDateFrom = 2013-10-20; // date
    let expiryDateTo = 2013-10-20; // date
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID
    let status = DRAFT; // String
    let page = 1; // Integer
    let order = Status ASC; // String
    let quoteNumber = QU-0001; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getQuotes(xeroTenantId, ifModifiedSince, dateFrom, dateTo, expiryDateFrom, expiryDateTo, contactID, status, page, order, quoteNumber, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
DateFrom
date (date)
Filter for quotes after a particular date
DateTo
date (date)
Filter for quotes before a particular date
ExpiryDateFrom
date (date)
Filter for quotes expiring after a particular date
ExpiryDateTo
date (date)
Filter for quotes before a particular date
ContactID
UUID (uuid)
Filter for quotes belonging to a particular contact
Status
String
Filter for quotes of a particular Status
page
Integer
e.g. page=1 – Up to 100 Quotes will be returned in a single API call with line items shown for each quote
order
String
Order by an any element
QuoteNumber
String
Filter by quote number (e.g. GET https://.../Quotes?QuoteNumber=QU-0001)

getReceipt

Retrieves a specific draft expense claim receipt by using a unique receipt Id


/Receipts/{ReceiptID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Receipts/{ReceiptID}?unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID receiptID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Integer unitdp = 4;

        try {
            Receipts result = apiInstance.getReceipt(accessToken, xeroTenantId, receiptID, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReceipt");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID receiptID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Receipt
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Receipts result = apiInstance.getReceipt(xeroTenantId, receiptID, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReceipt");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *receiptID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Receipt (default to null)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific draft expense claim receipt by using a unique receipt Id
[apiInstance getReceiptWith:xeroTenantId
    receiptID:receiptID
    unitdp:unitdp
              completionHandler: ^(Receipts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const receiptID = '00000000-0000-0000-0000-000000000000';
const unitdp = 4;

try {
  const response = await xero.accountingApi.getReceipt(xeroTenantId, receiptID,  unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetReceiptExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var receiptID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var unitdp = 4;
            
            try {
                var result = await apiInstance.GetReceiptAsync(accessToken, xeroTenantId, receiptID, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetReceipt: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$receiptID = "00000000-0000-0000-0000-000000000000";
$unitdp = 4;

try {
  $result = $apiInstance->getReceipt($xeroTenantId, $receiptID, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReceipt: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $receiptID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Receipt
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->getReceipt(xeroTenantId => $xeroTenantId, receiptID => $receiptID, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReceipt: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_receipt():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    receipt_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_receipt(xero_tenant_id, receipt_id, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReceipt: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let receiptID = 00000000-0000-0000-0000-000000000000; // UUID
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getReceipt(xeroTenantId, receiptID, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
ReceiptID*
UUID (uuid)
Unique identifier for a Receipt
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

getReceiptAttachmentByFileName

Retrieves a specific attachment from a specific expense claim receipts by file name


/Receipts/{ReceiptID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Receipts/{ReceiptID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID receiptID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        String contentType = 'image/jpg';

        try {
            ByteArrayInputStream result = apiInstance.getReceiptAttachmentByFileName(accessToken, xeroTenantId, receiptID, fileName, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReceiptAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID receiptID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Receipt
        String fileName = xero-dev.jpg; // String | Name of the attachment
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getReceiptAttachmentByFileName(xeroTenantId, receiptID, fileName, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReceiptAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *receiptID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Receipt (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific expense claim receipts by file name
[apiInstance getReceiptAttachmentByFileNameWith:xeroTenantId
    receiptID:receiptID
    fileName:fileName
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const receiptID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getReceiptAttachmentByFileName(xeroTenantId, receiptID, fileName, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetReceiptAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var receiptID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetReceiptAttachmentByFileNameAsync(accessToken, xeroTenantId, receiptID, fileName, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetReceiptAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$receiptID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getReceiptAttachmentByFileName($xeroTenantId, $receiptID, $fileName, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReceiptAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $receiptID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Receipt
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getReceiptAttachmentByFileName(xeroTenantId => $xeroTenantId, receiptID => $receiptID, fileName => $fileName, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReceiptAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_receipt_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    receipt_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_receipt_attachment_by_file_name(xero_tenant_id, receipt_id, file_name, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReceiptAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let receiptID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getReceiptAttachmentByFileName(xeroTenantId, receiptID, fileName, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
ReceiptID*
UUID (uuid)
Unique identifier for a Receipt
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getReceiptAttachmentById

Retrieves a specific attachments from a specific expense claim receipts by using a unique attachment Id


/Receipts/{ReceiptID}/Attachments/{AttachmentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Receipts/{ReceiptID}/Attachments/{AttachmentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID receiptID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID attachmentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String contentType = 'image/jpg';

        try {
            ByteArrayInputStream result = apiInstance.getReceiptAttachmentById(accessToken, xeroTenantId, receiptID, attachmentID, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReceiptAttachmentById");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID receiptID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Receipt
        UUID attachmentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Attachment object
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getReceiptAttachmentById(xeroTenantId, receiptID, attachmentID, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReceiptAttachmentById");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *receiptID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Receipt (default to null)
UUID *attachmentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Attachment object (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachments from a specific expense claim receipts by using a unique attachment Id
[apiInstance getReceiptAttachmentByIdWith:xeroTenantId
    receiptID:receiptID
    attachmentID:attachmentID
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const receiptID = '00000000-0000-0000-0000-000000000000';
const attachmentID = '00000000-0000-0000-0000-000000000000';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getReceiptAttachmentById(xeroTenantId, receiptID, attachmentID, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetReceiptAttachmentByIdExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var receiptID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var attachmentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetReceiptAttachmentByIdAsync(accessToken, xeroTenantId, receiptID, attachmentID, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetReceiptAttachmentById: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$receiptID = "00000000-0000-0000-0000-000000000000";
$attachmentID = "00000000-0000-0000-0000-000000000000";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getReceiptAttachmentById($xeroTenantId, $receiptID, $attachmentID, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReceiptAttachmentById: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $receiptID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Receipt
my $attachmentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Attachment object
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getReceiptAttachmentById(xeroTenantId => $xeroTenantId, receiptID => $receiptID, attachmentID => $attachmentID, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReceiptAttachmentById: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_receipt_attachment_by_id():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    receipt_id = '00000000-0000-0000-0000-000000000000'
    attachment_id = '00000000-0000-0000-0000-000000000000'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_receipt_attachment_by_id(xero_tenant_id, receipt_id, attachment_id, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReceiptAttachmentById: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let receiptID = 00000000-0000-0000-0000-000000000000; // UUID
    let attachmentID = 00000000-0000-0000-0000-000000000000; // UUID
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getReceiptAttachmentById(xeroTenantId, receiptID, attachmentID, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
ReceiptID*
UUID (uuid)
Unique identifier for a Receipt
Required
AttachmentID*
UUID (uuid)
Unique identifier for Attachment object
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getReceiptAttachments

Retrieves attachments for a specific expense claim receipt


/Receipts/{ReceiptID}/Attachments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Receipts/{ReceiptID}/Attachments"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID receiptID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Attachments result = apiInstance.getReceiptAttachments(accessToken, xeroTenantId, receiptID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReceiptAttachments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID receiptID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Receipt
        try {
            Attachments result = apiInstance.getReceiptAttachments(xeroTenantId, receiptID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReceiptAttachments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *receiptID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Receipt (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves attachments for a specific expense claim receipt
[apiInstance getReceiptAttachmentsWith:xeroTenantId
    receiptID:receiptID
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const receiptID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getReceiptAttachments(xeroTenantId, receiptID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetReceiptAttachmentsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var receiptID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetReceiptAttachmentsAsync(accessToken, xeroTenantId, receiptID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetReceiptAttachments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$receiptID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getReceiptAttachments($xeroTenantId, $receiptID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReceiptAttachments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $receiptID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Receipt

eval { 
    my $result = $api_instance->getReceiptAttachments(xeroTenantId => $xeroTenantId, receiptID => $receiptID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReceiptAttachments: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_receipt_attachments():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    receipt_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_receipt_attachments(xero_tenant_id, receipt_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReceiptAttachments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let receiptID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getReceiptAttachments(xeroTenantId, receiptID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
ReceiptID*
UUID (uuid)
Unique identifier for a Receipt
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getReceiptHistory

Retrieves a history record for a specific receipt


/Receipts/{ReceiptID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Receipts/{ReceiptID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID receiptID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getReceiptHistory(accessToken, xeroTenantId, receiptID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReceiptHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID receiptID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Receipt
        try {
            HistoryRecords result = apiInstance.getReceiptHistory(xeroTenantId, receiptID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReceiptHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *receiptID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Receipt (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a history record for a specific receipt
[apiInstance getReceiptHistoryWith:xeroTenantId
    receiptID:receiptID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const receiptID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getReceiptHistory(xeroTenantId, receiptID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetReceiptHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var receiptID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetReceiptHistoryAsync(accessToken, xeroTenantId, receiptID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetReceiptHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$receiptID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getReceiptHistory($xeroTenantId, $receiptID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReceiptHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $receiptID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Receipt

eval { 
    my $result = $api_instance->getReceiptHistory(xeroTenantId => $xeroTenantId, receiptID => $receiptID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReceiptHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_receipt_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    receipt_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_receipt_history(xero_tenant_id, receipt_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReceiptHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let receiptID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getReceiptHistory(xeroTenantId, receiptID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
ReceiptID*
UUID (uuid)
Unique identifier for a Receipt
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getReceipts

Retrieves draft expense claim receipts for any user


/Receipts

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Receipts?where=Status=="DRAFT"&order=ReceiptNumber ASC&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';

        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = 'Status=="DRAFT"';
        String order = 'ReceiptNumber ASC';
        Integer unitdp = 4;

        try {
            Receipts result = apiInstance.getReceipts(accessToken, xeroTenantId, ifModifiedSince, where, order, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReceipts");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = Status=="DRAFT"; // String | Filter by an any element
        String order = ReceiptNumber ASC; // String | Order by an any element
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Receipts result = apiInstance.getReceipts(xeroTenantId, ifModifiedSince, where, order, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReceipts");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = Status=="DRAFT"; // Filter by an any element (optional) (default to null)
String *order = ReceiptNumber ASC; // Order by an any element (optional) (default to null)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves draft expense claim receipts for any user
[apiInstance getReceiptsWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
    unitdp:unitdp
              completionHandler: ^(Receipts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'Status=="DRAFT"';
const order = 'ReceiptNumber ASC';
const unitdp = 4;

try {
  const response = await xero.accountingApi.getReceipts(xeroTenantId, ifModifiedSince, where, order, unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetReceiptsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var ifModifiedSince = DateTime.Parse("2020-02-06T12:17:43.202-08:00");
            var where = "Status==\"DRAFT\"";
            var order = "ReceiptNumber ASC";
            var unitdp = 4;
            
            try {
                var result = await apiInstance.GetReceiptsAsync(accessToken, xeroTenantId, ifModifiedSince, where, order, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetReceipts: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\Receipt::STATUS_DRAFT . '"";
$order = "ReceiptNumber ASC";
$unitdp = 4;

try {
  $result = $apiInstance->getReceipts($xeroTenantId, $ifModifiedSince, $where, $order, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReceipts: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = Status=="DRAFT"; # String | Filter by an any element
my $order = ReceiptNumber ASC; # String | Order by an any element
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->getReceipts(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReceipts: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_receipts():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    if_modified_since = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'Status=="DRAFT"'
    order = 'ReceiptNumber ASC'
    
    try:
        api_response = api_instance.get_receipts(xero_tenant_id, if_modified_since, where, order, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReceipts: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = Status=="DRAFT"; // String
    let order = ReceiptNumber ASC; // String
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getReceipts(xeroTenantId, ifModifiedSince, where, order, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

getRepeatingInvoice

Retrieves a specific repeating invoice by using a unique repeating invoice Id


/RepeatingInvoices/{RepeatingInvoiceID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/RepeatingInvoices/{RepeatingInvoiceID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID repeatingInvoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            RepeatingInvoices result = apiInstance.getRepeatingInvoice(accessToken, xeroTenantId, repeatingInvoiceID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getRepeatingInvoice");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Repeating Invoice
        try {
            RepeatingInvoices result = apiInstance.getRepeatingInvoice(xeroTenantId, repeatingInvoiceID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getRepeatingInvoice");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Repeating Invoice (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific repeating invoice by using a unique repeating invoice Id
[apiInstance getRepeatingInvoiceWith:xeroTenantId
    repeatingInvoiceID:repeatingInvoiceID
              completionHandler: ^(RepeatingInvoices output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const repeatingInvoiceID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getRepeatingInvoice(xeroTenantId, repeatingInvoiceID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetRepeatingInvoiceExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var repeatingInvoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetRepeatingInvoiceAsync(accessToken, xeroTenantId, repeatingInvoiceID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetRepeatingInvoice: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$repeatingInvoiceID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getRepeatingInvoice($xeroTenantId, $repeatingInvoiceID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getRepeatingInvoice: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Repeating Invoice

eval { 
    my $result = $api_instance->getRepeatingInvoice(xeroTenantId => $xeroTenantId, repeatingInvoiceID => $repeatingInvoiceID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getRepeatingInvoice: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_repeating_invoice():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    repeating_invoice_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_repeating_invoice(xero_tenant_id, repeating_invoice_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getRepeatingInvoice: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getRepeatingInvoice(xeroTenantId, repeatingInvoiceID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
RepeatingInvoiceID*
UUID (uuid)
Unique identifier for a Repeating Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getRepeatingInvoiceAttachmentByFileName

Retrieves a specific attachment from a specific repeating invoices by file name


/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID repeatingInvoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        String contentType = 'image/jpg';

        try {
            ByteArrayInputStream result = apiInstance.getRepeatingInvoiceAttachmentByFileName(accessToken, xeroTenantId, repeatingInvoiceID, fileName, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getRepeatingInvoiceAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Repeating Invoice
        String fileName = xero-dev.jpg; // String | Name of the attachment
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getRepeatingInvoiceAttachmentByFileName(xeroTenantId, repeatingInvoiceID, fileName, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getRepeatingInvoiceAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Repeating Invoice (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific repeating invoices by file name
[apiInstance getRepeatingInvoiceAttachmentByFileNameWith:xeroTenantId
    repeatingInvoiceID:repeatingInvoiceID
    fileName:fileName
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const repeatingInvoiceID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getRepeatingInvoiceAttachmentByFileName(xeroTenantId, repeatingInvoiceID, fileName, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetRepeatingInvoiceAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var repeatingInvoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetRepeatingInvoiceAttachmentByFileNameAsync(accessToken, xeroTenantId, repeatingInvoiceID, fileName, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetRepeatingInvoiceAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$repeatingInvoiceID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getRepeatingInvoiceAttachmentByFileName($xeroTenantId, $repeatingInvoiceID, $fileName, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getRepeatingInvoiceAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Repeating Invoice
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getRepeatingInvoiceAttachmentByFileName(xeroTenantId => $xeroTenantId, repeatingInvoiceID => $repeatingInvoiceID, fileName => $fileName, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getRepeatingInvoiceAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_repeating_invoice_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    repeating_invoice_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_repeating_invoice_attachment_by_file_name(xero_tenant_id, repeating_invoice_id, file_name, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getRepeatingInvoiceAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getRepeatingInvoiceAttachmentByFileName(xeroTenantId, repeatingInvoiceID, fileName, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
RepeatingInvoiceID*
UUID (uuid)
Unique identifier for a Repeating Invoice
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getRepeatingInvoiceAttachmentById

Retrieves a specific attachment from a specific repeating invoice


/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{AttachmentID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID repeatingInvoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID attachmentID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String contentType = 'image/jpg';

        try {
            ByteArrayInputStream result = apiInstance.getRepeatingInvoiceAttachmentById(accessToken, xeroTenantId, repeatingInvoiceID, attachmentID, contentType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getRepeatingInvoiceAttachmentById");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Repeating Invoice
        UUID attachmentID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Attachment object
        String contentType = image/jpg; // String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
        try {
            File result = apiInstance.getRepeatingInvoiceAttachmentById(xeroTenantId, repeatingInvoiceID, attachmentID, contentType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getRepeatingInvoiceAttachmentById");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Repeating Invoice (default to null)
UUID *attachmentID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Attachment object (default to null)
String *contentType = image/jpg; // The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific attachment from a specific repeating invoice
[apiInstance getRepeatingInvoiceAttachmentByIdWith:xeroTenantId
    repeatingInvoiceID:repeatingInvoiceID
    attachmentID:attachmentID
    contentType:contentType
              completionHandler: ^(File output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const repeatingInvoiceID = '00000000-0000-0000-0000-000000000000';
const attachmentID = '00000000-0000-0000-0000-000000000000';
const contentType = 'image/jpg';

try {
  const response = await xero.accountingApi.getRepeatingInvoiceAttachmentById(xeroTenantId, repeatingInvoiceID, attachmentID, contentType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetRepeatingInvoiceAttachmentByIdExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var repeatingInvoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var attachmentID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var contentType = "image/jpg";
            
            try {
                var result = await apiInstance.GetRepeatingInvoiceAttachmentByIdAsync(accessToken, xeroTenantId, repeatingInvoiceID, attachmentID, contentType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetRepeatingInvoiceAttachmentById: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$repeatingInvoiceID = "00000000-0000-0000-0000-000000000000";
$attachmentID = "00000000-0000-0000-0000-000000000000";
$contentType = "image/jpg";

try {
  $result = $apiInstance->getRepeatingInvoiceAttachmentById($xeroTenantId, $repeatingInvoiceID, $attachmentID, $contentType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getRepeatingInvoiceAttachmentById: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Repeating Invoice
my $attachmentID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Attachment object
my $contentType = image/jpg; # String | The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf

eval { 
    my $result = $api_instance->getRepeatingInvoiceAttachmentById(xeroTenantId => $xeroTenantId, repeatingInvoiceID => $repeatingInvoiceID, attachmentID => $attachmentID, contentType => $contentType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getRepeatingInvoiceAttachmentById: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_repeating_invoice_attachment_by_id():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    repeating_invoice_id = '00000000-0000-0000-0000-000000000000'
    attachment_id = '00000000-0000-0000-0000-000000000000'
    content_type = 'image/jpg'
    
    try:
        api_response = api_instance.get_repeating_invoice_attachment_by_id(xero_tenant_id, repeating_invoice_id, attachment_id, content_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getRepeatingInvoiceAttachmentById: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let attachmentID = 00000000-0000-0000-0000-000000000000; // UUID
    let contentType = image/jpg; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getRepeatingInvoiceAttachmentById(xeroTenantId, repeatingInvoiceID, attachmentID, contentType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
RepeatingInvoiceID*
UUID (uuid)
Unique identifier for a Repeating Invoice
Required
AttachmentID*
UUID (uuid)
Unique identifier for Attachment object
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
contentType*
String
The mime type of the attachment file you are retrieving i.e image/jpg, application/pdf
Required

getRepeatingInvoiceAttachments

Retrieves attachments from a specific repeating invoice


/RepeatingInvoices/{RepeatingInvoiceID}/Attachments

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/RepeatingInvoices/{RepeatingInvoiceID}/Attachments"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID repeatingInvoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Attachments result = apiInstance.getRepeatingInvoiceAttachments(accessToken, xeroTenantId, repeatingInvoiceID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getRepeatingInvoiceAttachments");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Repeating Invoice
        try {
            Attachments result = apiInstance.getRepeatingInvoiceAttachments(xeroTenantId, repeatingInvoiceID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getRepeatingInvoiceAttachments");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Repeating Invoice (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves attachments from a specific repeating invoice
[apiInstance getRepeatingInvoiceAttachmentsWith:xeroTenantId
    repeatingInvoiceID:repeatingInvoiceID
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const repeatingInvoiceID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getRepeatingInvoiceAttachments(xeroTenantId, repeatingInvoiceID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetRepeatingInvoiceAttachmentsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var repeatingInvoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetRepeatingInvoiceAttachmentsAsync(accessToken, xeroTenantId, repeatingInvoiceID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetRepeatingInvoiceAttachments: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$repeatingInvoiceID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getRepeatingInvoiceAttachments($xeroTenantId, $repeatingInvoiceID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getRepeatingInvoiceAttachments: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Repeating Invoice

eval { 
    my $result = $api_instance->getRepeatingInvoiceAttachments(xeroTenantId => $xeroTenantId, repeatingInvoiceID => $repeatingInvoiceID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getRepeatingInvoiceAttachments: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_repeating_invoice_attachments():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    repeating_invoice_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_repeating_invoice_attachments(xero_tenant_id, repeating_invoice_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getRepeatingInvoiceAttachments: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getRepeatingInvoiceAttachments(xeroTenantId, repeatingInvoiceID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments.read Grant read-only access to attachments

Parameters

Path parameters
Name Description
RepeatingInvoiceID*
UUID (uuid)
Unique identifier for a Repeating Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getRepeatingInvoiceHistory

Retrieves history record for a specific repeating invoice


/RepeatingInvoices/{RepeatingInvoiceID}/History

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/RepeatingInvoices/{RepeatingInvoiceID}/History"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID repeatingInvoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            HistoryRecords result = apiInstance.getRepeatingInvoiceHistory(accessToken, xeroTenantId, repeatingInvoiceID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getRepeatingInvoiceHistory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Repeating Invoice
        try {
            HistoryRecords result = apiInstance.getRepeatingInvoiceHistory(xeroTenantId, repeatingInvoiceID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getRepeatingInvoiceHistory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Repeating Invoice (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves history record for a specific repeating invoice
[apiInstance getRepeatingInvoiceHistoryWith:xeroTenantId
    repeatingInvoiceID:repeatingInvoiceID
              completionHandler: ^(HistoryRecords output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const repeatingInvoiceID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getRepeatingInvoiceHistory(xeroTenantId, repeatingInvoiceID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetRepeatingInvoiceHistoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var repeatingInvoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetRepeatingInvoiceHistoryAsync(accessToken, xeroTenantId, repeatingInvoiceID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetRepeatingInvoiceHistory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$repeatingInvoiceID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getRepeatingInvoiceHistory($xeroTenantId, $repeatingInvoiceID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getRepeatingInvoiceHistory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Repeating Invoice

eval { 
    my $result = $api_instance->getRepeatingInvoiceHistory(xeroTenantId => $xeroTenantId, repeatingInvoiceID => $repeatingInvoiceID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getRepeatingInvoiceHistory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_repeating_invoice_history():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    repeating_invoice_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_repeating_invoice_history(xero_tenant_id, repeating_invoice_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getRepeatingInvoiceHistory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getRepeatingInvoiceHistory(xeroTenantId, repeatingInvoiceID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Path parameters
Name Description
RepeatingInvoiceID*
UUID (uuid)
Unique identifier for a Repeating Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getRepeatingInvoices

Retrieves repeating invoices


/RepeatingInvoices

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/RepeatingInvoices?where=Status=="DRAFT"&order=Total ASC"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        String where = 'Status=="DRAFT"';
        String order = 'Total ASC';

        try {
            RepeatingInvoices result = apiInstance.getRepeatingInvoices(accessToken, xeroTenantId, where, order);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getRepeatingInvoices");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        String where = Status=="DRAFT"; // String | Filter by an any element
        String order = Total ASC; // String | Order by an any element
        try {
            RepeatingInvoices result = apiInstance.getRepeatingInvoices(xeroTenantId, where, order);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getRepeatingInvoices");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
String *where = Status=="DRAFT"; // Filter by an any element (optional) (default to null)
String *order = Total ASC; // Order by an any element (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves repeating invoices
[apiInstance getRepeatingInvoicesWith:xeroTenantId
    where:where
    order:order
              completionHandler: ^(RepeatingInvoices output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const where = 'Status=="DRAFT"';
const order = 'Total ASC';

try {
  const response = await xero.accountingApi.getRepeatingInvoices(xeroTenantId,  where, order);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetRepeatingInvoicesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var where = "Status==\"DRAFT\"";
            var order = "Total ASC";
            
            try {
                var result = await apiInstance.GetRepeatingInvoicesAsync(accessToken, xeroTenantId, where, order);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetRepeatingInvoices: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\RepeatingInvoice::STATUS_DRAFT . '"";
$order = "Total ASC";

try {
  $result = $apiInstance->getRepeatingInvoices($xeroTenantId, $where, $order);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getRepeatingInvoices: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $where = Status=="DRAFT"; # String | Filter by an any element
my $order = Total ASC; # String | Order by an any element

eval { 
    my $result = $api_instance->getRepeatingInvoices(xeroTenantId => $xeroTenantId, where => $where, order => $order);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getRepeatingInvoices: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_repeating_invoices():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    where = 'Status=="DRAFT"'
    order = 'Total ASC'
    
    try:
        api_response = api_instance.get_repeating_invoices(xero_tenant_id, where, order)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getRepeatingInvoices: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let where = Status=="DRAFT"; // String
    let order = Total ASC; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getRepeatingInvoices(xeroTenantId, where, order, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions.read Grant read-only access to invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element

getReportAgedPayablesByContact

Retrieves report for aged payables by contact


/Reports/AgedPayablesByContact

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Reports/AgedPayablesByContact?contactId=00000000-0000-0000-0000-000000000000&date=2013-10-20&fromDate=2013-10-20&toDate=2013-10-20"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID contactId = UUID.fromString("00000000-0000-0000-0000-000000000000");
        date date = 2013-10-20;
        date fromDate = 2013-10-20;
        date toDate = 2013-10-20;

        try {
            ReportWithRows result = apiInstance.getReportAgedPayablesByContact(accessToken, xeroTenantId, contactId, date, fromDate, toDate);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReportAgedPayablesByContact");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactId = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        date date = 2013-10-20; // date | The date of the Aged Payables By Contact report
        date fromDate = 2013-10-20; // date | filter by the from date of the report e.g. 2021-02-01
        date toDate = 2013-10-20; // date | filter by the to date of the report e.g. 2021-02-28
        try {
            ReportWithRows result = apiInstance.getReportAgedPayablesByContact(xeroTenantId, contactId, date, fromDate, toDate);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReportAgedPayablesByContact");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactId = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)
date *date = 2013-10-20; // The date of the Aged Payables By Contact report (optional) (default to null)
date *fromDate = 2013-10-20; // filter by the from date of the report e.g. 2021-02-01 (optional) (default to null)
date *toDate = 2013-10-20; // filter by the to date of the report e.g. 2021-02-28 (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves report for aged payables by contact
[apiInstance getReportAgedPayablesByContactWith:xeroTenantId
    contactId:contactId
    date:date
    fromDate:fromDate
    toDate:toDate
              completionHandler: ^(ReportWithRows output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactId = '00000000-0000-0000-0000-000000000000';
const date: Date = new Date("2013-10-20");
const fromDate: Date = new Date("2013-10-20");
const toDate: Date = new Date("2013-10-20");

try {
  const response = await xero.accountingApi.getReportAgedPayablesByContact(xeroTenantId, contactId,  date, fromDate, toDate);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetReportAgedPayablesByContactExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactId = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var date = DateTime.Parse("2013-10-20");
            var fromDate = DateTime.Parse("2013-10-20");
            var toDate = DateTime.Parse("2013-10-20");
            
            try {
                var result = await apiInstance.GetReportAgedPayablesByContactAsync(accessToken, xeroTenantId, contactId, date, fromDate, toDate);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetReportAgedPayablesByContact: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactId = "00000000-0000-0000-0000-000000000000";
$date = new DateTime("2013-10-20");
$fromDate = new DateTime("2013-10-20");
$toDate = new DateTime("2013-10-20");

try {
  $result = $apiInstance->getReportAgedPayablesByContact($xeroTenantId, $contactId, $date, $fromDate, $toDate);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReportAgedPayablesByContact: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactId = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact
my $date = 2013-10-20; # date | The date of the Aged Payables By Contact report
my $fromDate = 2013-10-20; # date | filter by the from date of the report e.g. 2021-02-01
my $toDate = 2013-10-20; # date | filter by the to date of the report e.g. 2021-02-28

eval { 
    my $result = $api_instance->getReportAgedPayablesByContact(xeroTenantId => $xeroTenantId, contactId => $contactId, date => $date, fromDate => $fromDate, toDate => $toDate);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReportAgedPayablesByContact: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_report_aged_payables_by_contact():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    contact_id = '00000000-0000-0000-0000-000000000000'
    date = dateutil.parser.parse("2013-10-20")
    from_date = dateutil.parser.parse("2013-10-20")
    to_date = dateutil.parser.parse("2013-10-20")
    
    try:
        api_response = api_instance.get_report_aged_payables_by_contact(xero_tenant_id, contact_id, date, from_date, to_date)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReportAgedPayablesByContact: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactId = 00000000-0000-0000-0000-000000000000; // UUID
    let date = 2013-10-20; // date
    let fromDate = 2013-10-20; // date
    let toDate = 2013-10-20; // date

    let mut context = AccountingApi::Context::default();
    let result = client.getReportAgedPayablesByContact(xeroTenantId, contactId, date, fromDate, toDate, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.reports.read Grant read-only access to accounting reports

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
contactId*
UUID (uuid)
Unique identifier for a Contact
Required
date
date (date)
The date of the Aged Payables By Contact report
fromDate
date (date)
filter by the from date of the report e.g. 2021-02-01
toDate
date (date)
filter by the to date of the report e.g. 2021-02-28

getReportAgedReceivablesByContact

Retrieves report for aged receivables by contact


/Reports/AgedReceivablesByContact

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Reports/AgedReceivablesByContact?contactId=00000000-0000-0000-0000-000000000000&date=2013-10-20&fromDate=2013-10-20&toDate=2013-10-20"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID contactId = UUID.fromString("00000000-0000-0000-0000-000000000000");
        date date = 2013-10-20;
        date fromDate = 2013-10-20;
        date toDate = 2013-10-20;

        try {
            ReportWithRows result = apiInstance.getReportAgedReceivablesByContact(accessToken, xeroTenantId, contactId, date, fromDate, toDate);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReportAgedReceivablesByContact");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactId = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        date date = 2013-10-20; // date | The date of the Aged Receivables By Contact report
        date fromDate = 2013-10-20; // date | filter by the from date of the report e.g. 2021-02-01
        date toDate = 2013-10-20; // date | filter by the to date of the report e.g. 2021-02-28
        try {
            ReportWithRows result = apiInstance.getReportAgedReceivablesByContact(xeroTenantId, contactId, date, fromDate, toDate);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReportAgedReceivablesByContact");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactId = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)
date *date = 2013-10-20; // The date of the Aged Receivables By Contact report (optional) (default to null)
date *fromDate = 2013-10-20; // filter by the from date of the report e.g. 2021-02-01 (optional) (default to null)
date *toDate = 2013-10-20; // filter by the to date of the report e.g. 2021-02-28 (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves report for aged receivables by contact
[apiInstance getReportAgedReceivablesByContactWith:xeroTenantId
    contactId:contactId
    date:date
    fromDate:fromDate
    toDate:toDate
              completionHandler: ^(ReportWithRows output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactId = '00000000-0000-0000-0000-000000000000';
const date: Date = new Date("2013-10-20");
const fromDate: Date = new Date("2013-10-20");
const toDate: Date = new Date("2013-10-20");

try {
  const response = await xero.accountingApi.getReportAgedReceivablesByContact(xeroTenantId, contactId,  date, fromDate, toDate);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetReportAgedReceivablesByContactExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactId = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var date = DateTime.Parse("2013-10-20");
            var fromDate = DateTime.Parse("2013-10-20");
            var toDate = DateTime.Parse("2013-10-20");
            
            try {
                var result = await apiInstance.GetReportAgedReceivablesByContactAsync(accessToken, xeroTenantId, contactId, date, fromDate, toDate);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetReportAgedReceivablesByContact: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactId = "00000000-0000-0000-0000-000000000000";
$date = new DateTime("2013-10-20");
$fromDate = new DateTime("2013-10-20");
$toDate = new DateTime("2013-10-20");

try {
  $result = $apiInstance->getReportAgedReceivablesByContact($xeroTenantId, $contactId, $date, $fromDate, $toDate);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReportAgedReceivablesByContact: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactId = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact
my $date = 2013-10-20; # date | The date of the Aged Receivables By Contact report
my $fromDate = 2013-10-20; # date | filter by the from date of the report e.g. 2021-02-01
my $toDate = 2013-10-20; # date | filter by the to date of the report e.g. 2021-02-28

eval { 
    my $result = $api_instance->getReportAgedReceivablesByContact(xeroTenantId => $xeroTenantId, contactId => $contactId, date => $date, fromDate => $fromDate, toDate => $toDate);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReportAgedReceivablesByContact: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_report_aged_receivables_by_contact():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    contact_id = '00000000-0000-0000-0000-000000000000'
    date = dateutil.parser.parse("2013-10-20")
    from_date = dateutil.parser.parse("2013-10-20")
    to_date = dateutil.parser.parse("2013-10-20")
    
    try:
        api_response = api_instance.get_report_aged_receivables_by_contact(xero_tenant_id, contact_id, date, from_date, to_date)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReportAgedReceivablesByContact: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactId = 00000000-0000-0000-0000-000000000000; // UUID
    let date = 2013-10-20; // date
    let fromDate = 2013-10-20; // date
    let toDate = 2013-10-20; // date

    let mut context = AccountingApi::Context::default();
    let result = client.getReportAgedReceivablesByContact(xeroTenantId, contactId, date, fromDate, toDate, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.reports.read Grant read-only access to accounting reports

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
contactId*
UUID (uuid)
Unique identifier for a Contact
Required
date
date (date)
The date of the Aged Receivables By Contact report
fromDate
date (date)
filter by the from date of the report e.g. 2021-02-01
toDate
date (date)
filter by the to date of the report e.g. 2021-02-28

getReportBASorGST

Retrieves a specific report for BAS using a unique report Id (only valid for AU orgs)


/Reports/{ReportID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Reports/{ReportID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        String reportID = '00000000-0000-0000-0000-000000000000';

        try {
            ReportWithRows result = apiInstance.getReportBASorGST(accessToken, xeroTenantId, reportID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReportBASorGST");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        String reportID = 00000000-0000-0000-0000-000000000000; // String | Unique identifier for a Report
        try {
            ReportWithRows result = apiInstance.getReportBASorGST(xeroTenantId, reportID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReportBASorGST");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
String *reportID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Report (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific report for BAS using a unique report Id (only valid for AU orgs)
[apiInstance getReportBASorGSTWith:xeroTenantId
    reportID:reportID
              completionHandler: ^(ReportWithRows output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const reportID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getReportBASorGST(xeroTenantId, reportID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetReportBASorGSTExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var reportID = "00000000-0000-0000-0000-000000000000";
            
            try {
                var result = await apiInstance.GetReportBASorGSTAsync(accessToken, xeroTenantId, reportID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetReportBASorGST: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$reportID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getReportBASorGST($xeroTenantId, $reportID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReportBASorGST: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $reportID = 00000000-0000-0000-0000-000000000000; # String | Unique identifier for a Report

eval { 
    my $result = $api_instance->getReportBASorGST(xeroTenantId => $xeroTenantId, reportID => $reportID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReportBASorGST: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_report_ba_sor_gst():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    report_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_report_ba_sor_gst(xero_tenant_id, report_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReportBASorGST: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let reportID = 00000000-0000-0000-0000-000000000000; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getReportBASorGST(xeroTenantId, reportID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.reports.read Grant read-only access to accounting reports

Parameters

Path parameters
Name Description
ReportID*
String
Unique identifier for a Report
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getReportBASorGSTList

Retrieves report for BAS (only valid for AU orgs)


/Reports

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Reports"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';

        try {
            ReportWithRows result = apiInstance.getReportBASorGSTList(accessToken, xeroTenantId);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReportBASorGSTList");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        try {
            ReportWithRows result = apiInstance.getReportBASorGSTList(xeroTenantId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReportBASorGSTList");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves report for BAS (only valid for AU orgs)
[apiInstance getReportBASorGSTListWith:xeroTenantId
              completionHandler: ^(ReportWithRows output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';

try {
  const response = await xero.accountingApi.getReportBASorGSTList(xeroTenantId);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetReportBASorGSTListExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            
            try {
                var result = await apiInstance.GetReportBASorGSTListAsync(accessToken, xeroTenantId);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetReportBASorGSTList: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

try {
  $result = $apiInstance->getReportBASorGSTList($xeroTenantId);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReportBASorGSTList: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant

eval { 
    my $result = $api_instance->getReportBASorGSTList(xeroTenantId => $xeroTenantId);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReportBASorGSTList: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_report_ba_sor_gst_list():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    
    try:
        api_response = api_instance.get_report_ba_sor_gst_list(xero_tenant_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReportBASorGSTList: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getReportBASorGSTList(xeroTenantId, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.reports.read Grant read-only access to accounting reports

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getReportBalanceSheet

Retrieves report for balancesheet


/Reports/BalanceSheet

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Reports/BalanceSheet?date=2019-11-01&periods=3&timeframe=MONTH&trackingOptionID1=00000000-0000-0000-0000-000000000000&trackingOptionID2=00000000-0000-0000-0000-000000000000&standardLayout=true&paymentsOnly=false"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        date date = 2019-11-01;
        Integer periods = 3;
        String timeframe = 'MONTH';
        String trackingOptionID1 = '00000000-0000-0000-0000-000000000000';
        String trackingOptionID2 = '00000000-0000-0000-0000-000000000000';
        Boolean standardLayout = true;
        Boolean paymentsOnly = false;

        try {
            ReportWithRows result = apiInstance.getReportBalanceSheet(accessToken, xeroTenantId, date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReportBalanceSheet");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        date date = 2019-11-01; // date | The date of the Balance Sheet report
        Integer periods = 3; // Integer | The number of periods for the Balance Sheet report
        String timeframe = MONTH; // String | The period size to compare to (MONTH, QUARTER, YEAR)
        String trackingOptionID1 = 00000000-0000-0000-0000-000000000000; // String | The tracking option 1 for the Balance Sheet report
        String trackingOptionID2 = 00000000-0000-0000-0000-000000000000; // String | The tracking option 2 for the Balance Sheet report
        Boolean standardLayout = true; // Boolean | The standard layout boolean for the Balance Sheet report
        Boolean paymentsOnly = false; // Boolean | return a cash basis for the Balance Sheet report
        try {
            ReportWithRows result = apiInstance.getReportBalanceSheet(xeroTenantId, date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReportBalanceSheet");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
date *date = 2019-11-01; // The date of the Balance Sheet report (optional) (default to null)
Integer *periods = 3; // The number of periods for the Balance Sheet report (optional) (default to null)
String *timeframe = MONTH; // The period size to compare to (MONTH, QUARTER, YEAR) (optional) (default to null)
String *trackingOptionID1 = 00000000-0000-0000-0000-000000000000; // The tracking option 1 for the Balance Sheet report (optional) (default to null)
String *trackingOptionID2 = 00000000-0000-0000-0000-000000000000; // The tracking option 2 for the Balance Sheet report (optional) (default to null)
Boolean *standardLayout = true; // The standard layout boolean for the Balance Sheet report (optional) (default to null)
Boolean *paymentsOnly = false; // return a cash basis for the Balance Sheet report (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves report for balancesheet
[apiInstance getReportBalanceSheetWith:xeroTenantId
    date:date
    periods:periods
    timeframe:timeframe
    trackingOptionID1:trackingOptionID1
    trackingOptionID2:trackingOptionID2
    standardLayout:standardLayout
    paymentsOnly:paymentsOnly
              completionHandler: ^(ReportWithRows output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const date: Date = new Date("2019-11-01");
const periods = 3;
const timeframe = 'MONTH';
const trackingOptionID1 = '00000000-0000-0000-0000-000000000000';
const trackingOptionID2 = '00000000-0000-0000-0000-000000000000';
const standardLayout = true;
const paymentsOnly = false;

try {
  const response = await xero.accountingApi.getReportBalanceSheet(xeroTenantId,  date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetReportBalanceSheetExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var date = DateTime.Parse("2019-11-01");
            var periods = 3;
            var timeframe = "MONTH";
            var trackingOptionID1 = "00000000-0000-0000-0000-000000000000";
            var trackingOptionID2 = "00000000-0000-0000-0000-000000000000";
            var standardLayout = true;
            var paymentsOnly = false;
            
            try {
                var result = await apiInstance.GetReportBalanceSheetAsync(accessToken, xeroTenantId, date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetReportBalanceSheet: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$date = new DateTime("2019-11-01");
$periods = 3;
$timeframe = "MONTH";
$trackingOptionID1 = "00000000-0000-0000-0000-000000000000";
$trackingOptionID2 = "00000000-0000-0000-0000-000000000000";
$standardLayout = true;
$paymentsOnly = false;

try {
  $result = $apiInstance->getReportBalanceSheet($xeroTenantId, $date, $periods, $timeframe, $trackingOptionID1, $trackingOptionID2, $standardLayout, $paymentsOnly);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReportBalanceSheet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $date = 2019-11-01; # date | The date of the Balance Sheet report
my $periods = 3; # Integer | The number of periods for the Balance Sheet report
my $timeframe = MONTH; # String | The period size to compare to (MONTH, QUARTER, YEAR)
my $trackingOptionID1 = 00000000-0000-0000-0000-000000000000; # String | The tracking option 1 for the Balance Sheet report
my $trackingOptionID2 = 00000000-0000-0000-0000-000000000000; # String | The tracking option 2 for the Balance Sheet report
my $standardLayout = true; # Boolean | The standard layout boolean for the Balance Sheet report
my $paymentsOnly = false; # Boolean | return a cash basis for the Balance Sheet report

eval { 
    my $result = $api_instance->getReportBalanceSheet(xeroTenantId => $xeroTenantId, date => $date, periods => $periods, timeframe => $timeframe, trackingOptionID1 => $trackingOptionID1, trackingOptionID2 => $trackingOptionID2, standardLayout => $standardLayout, paymentsOnly => $paymentsOnly);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReportBalanceSheet: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_report_balance_sheet():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    date = dateutil.parser.parse("2019-11-01")
    time_frame = 'MONTH'
    tracking_option_id_1 = '00000000-0000-0000-0000-000000000000'
    tracking_option_id_2 = '00000000-0000-0000-0000-000000000000'
    standard_layout = 'true'
    payments_only = 'false'
    
    try:
        api_response = api_instance.get_report_balance_sheet(xero_tenant_id, date, periods, time_frame, tracking_option_id_1, tracking_option_id_2, standard_layout, payments_only)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReportBalanceSheet: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let date = 2019-11-01; // date
    let periods = 3; // Integer
    let timeframe = MONTH; // String
    let trackingOptionID1 = 00000000-0000-0000-0000-000000000000; // String
    let trackingOptionID2 = 00000000-0000-0000-0000-000000000000; // String
    let standardLayout = true; // Boolean
    let paymentsOnly = false; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.getReportBalanceSheet(xeroTenantId, date, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.reports.read Grant read-only access to accounting reports

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
date
date (date)
The date of the Balance Sheet report
periods
Integer
The number of periods for the Balance Sheet report
timeframe
String
The period size to compare to (MONTH, QUARTER, YEAR)
trackingOptionID1
String
The tracking option 1 for the Balance Sheet report
trackingOptionID2
String
The tracking option 2 for the Balance Sheet report
standardLayout
Boolean
The standard layout boolean for the Balance Sheet report
paymentsOnly
Boolean
return a cash basis for the Balance Sheet report

getReportBankSummary

Retrieves report for bank summary


/Reports/BankSummary

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Reports/BankSummary?fromDate=2013-10-20&toDate=2013-10-20"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        date fromDate = 2013-10-20;
        date toDate = 2013-10-20;

        try {
            ReportWithRows result = apiInstance.getReportBankSummary(accessToken, xeroTenantId, fromDate, toDate);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReportBankSummary");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        date fromDate = 2013-10-20; // date | filter by the from date of the report e.g. 2021-02-01
        date toDate = 2013-10-20; // date | filter by the to date of the report e.g. 2021-02-28
        try {
            ReportWithRows result = apiInstance.getReportBankSummary(xeroTenantId, fromDate, toDate);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReportBankSummary");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
date *fromDate = 2013-10-20; // filter by the from date of the report e.g. 2021-02-01 (optional) (default to null)
date *toDate = 2013-10-20; // filter by the to date of the report e.g. 2021-02-28 (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves report for bank summary
[apiInstance getReportBankSummaryWith:xeroTenantId
    fromDate:fromDate
    toDate:toDate
              completionHandler: ^(ReportWithRows output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const fromDate: Date = new Date("2013-10-20");
const toDate: Date = new Date("2013-10-20");

try {
  const response = await xero.accountingApi.getReportBankSummary(xeroTenantId,  fromDate, toDate);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetReportBankSummaryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var fromDate = DateTime.Parse("2013-10-20");
            var toDate = DateTime.Parse("2013-10-20");
            
            try {
                var result = await apiInstance.GetReportBankSummaryAsync(accessToken, xeroTenantId, fromDate, toDate);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetReportBankSummary: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$fromDate = new DateTime("2013-10-20");
$toDate = new DateTime("2013-10-20");

try {
  $result = $apiInstance->getReportBankSummary($xeroTenantId, $fromDate, $toDate);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReportBankSummary: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $fromDate = 2013-10-20; # date | filter by the from date of the report e.g. 2021-02-01
my $toDate = 2013-10-20; # date | filter by the to date of the report e.g. 2021-02-28

eval { 
    my $result = $api_instance->getReportBankSummary(xeroTenantId => $xeroTenantId, fromDate => $fromDate, toDate => $toDate);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReportBankSummary: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_report_bank_summary():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    from_date = dateutil.parser.parse("2013-10-20")
    to_date = dateutil.parser.parse("2013-10-20")
    
    try:
        api_response = api_instance.get_report_bank_summary(xero_tenant_id, from_date, to_date)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReportBankSummary: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let fromDate = 2013-10-20; // date
    let toDate = 2013-10-20; // date

    let mut context = AccountingApi::Context::default();
    let result = client.getReportBankSummary(xeroTenantId, fromDate, toDate, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.reports.read Grant read-only access to accounting reports

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
fromDate
date (date)
filter by the from date of the report e.g. 2021-02-01
toDate
date (date)
filter by the to date of the report e.g. 2021-02-28

getReportBudgetSummary

Retrieves report for budget summary


/Reports/BudgetSummary

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Reports/BudgetSummary?date=2019-03-31&period=2&timeframe=3"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        date date = 2019-03-31;
        Integer period = 2;
        Integer timeframe = 3;

        try {
            ReportWithRows result = apiInstance.getReportBudgetSummary(accessToken, xeroTenantId, date, period, timeframe);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReportBudgetSummary");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        date date = 2019-03-31; // date | The date for the Bank Summary report e.g. 2018-03-31
        Integer period = 2; // Integer | The number of periods to compare (integer between 1 and 12)
        Integer timeframe = 3; // Integer | The period size to compare to (1=month, 3=quarter, 12=year)
        try {
            ReportWithRows result = apiInstance.getReportBudgetSummary(xeroTenantId, date, period, timeframe);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReportBudgetSummary");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
date *date = 2019-03-31; // The date for the Bank Summary report e.g. 2018-03-31 (optional) (default to null)
Integer *period = 2; // The number of periods to compare (integer between 1 and 12) (optional) (default to null)
Integer *timeframe = 3; // The period size to compare to (1=month, 3=quarter, 12=year) (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves report for budget summary
[apiInstance getReportBudgetSummaryWith:xeroTenantId
    date:date
    period:period
    timeframe:timeframe
              completionHandler: ^(ReportWithRows output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const date: Date = new Date("2019-03-31");
const period = 2;
const timeframe = 3;

try {
  const response = await xero.accountingApi.getReportBudgetSummary(xeroTenantId,  date, period, timeframe);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetReportBudgetSummaryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var date = DateTime.Parse("2019-03-31");
            var period = 2;
            var timeframe = 3;
            
            try {
                var result = await apiInstance.GetReportBudgetSummaryAsync(accessToken, xeroTenantId, date, period, timeframe);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetReportBudgetSummary: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$date = new DateTime("2019-03-31");
$period = 2;
$timeframe = 3;

try {
  $result = $apiInstance->getReportBudgetSummary($xeroTenantId, $date, $period, $timeframe);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReportBudgetSummary: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $date = 2019-03-31; # date | The date for the Bank Summary report e.g. 2018-03-31
my $period = 2; # Integer | The number of periods to compare (integer between 1 and 12)
my $timeframe = 3; # Integer | The period size to compare to (1=month, 3=quarter, 12=year)

eval { 
    my $result = $api_instance->getReportBudgetSummary(xeroTenantId => $xeroTenantId, date => $date, period => $period, timeframe => $timeframe);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReportBudgetSummary: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_report_budget_summary():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    date = dateutil.parser.parse("2019-03-31")
    
    try:
        api_response = api_instance.get_report_budget_summary(xero_tenant_id, date, period, time_frame)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReportBudgetSummary: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let date = 2019-03-31; // date
    let period = 2; // Integer
    let timeframe = 3; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.getReportBudgetSummary(xeroTenantId, date, period, timeframe, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.reports.read Grant read-only access to accounting reports

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
date
date (date)
The date for the Bank Summary report e.g. 2018-03-31
period
Integer
The number of periods to compare (integer between 1 and 12)
timeframe
Integer
The period size to compare to (1=month, 3=quarter, 12=year)

getReportExecutiveSummary

Retrieves report for executive summary


/Reports/ExecutiveSummary

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Reports/ExecutiveSummary?date=2019-03-31"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        date date = 2019-03-31;

        try {
            ReportWithRows result = apiInstance.getReportExecutiveSummary(accessToken, xeroTenantId, date);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReportExecutiveSummary");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        date date = 2019-03-31; // date | The date for the Bank Summary report e.g. 2018-03-31
        try {
            ReportWithRows result = apiInstance.getReportExecutiveSummary(xeroTenantId, date);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReportExecutiveSummary");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
date *date = 2019-03-31; // The date for the Bank Summary report e.g. 2018-03-31 (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves report for executive summary
[apiInstance getReportExecutiveSummaryWith:xeroTenantId
    date:date
              completionHandler: ^(ReportWithRows output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const date: Date = new Date("2019-03-31");

try {
  const response = await xero.accountingApi.getReportExecutiveSummary(xeroTenantId,  date);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetReportExecutiveSummaryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var date = DateTime.Parse("2019-03-31");
            
            try {
                var result = await apiInstance.GetReportExecutiveSummaryAsync(accessToken, xeroTenantId, date);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetReportExecutiveSummary: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$date = new DateTime("2019-03-31");

try {
  $result = $apiInstance->getReportExecutiveSummary($xeroTenantId, $date);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReportExecutiveSummary: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $date = 2019-03-31; # date | The date for the Bank Summary report e.g. 2018-03-31

eval { 
    my $result = $api_instance->getReportExecutiveSummary(xeroTenantId => $xeroTenantId, date => $date);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReportExecutiveSummary: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_report_executive_summary():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    date = dateutil.parser.parse("2019-03-31")
    
    try:
        api_response = api_instance.get_report_executive_summary(xero_tenant_id, date)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReportExecutiveSummary: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let date = 2019-03-31; // date

    let mut context = AccountingApi::Context::default();
    let result = client.getReportExecutiveSummary(xeroTenantId, date, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.reports.read Grant read-only access to accounting reports

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
date
date (date)
The date for the Bank Summary report e.g. 2018-03-31

getReportProfitAndLoss

Retrieves report for profit and loss


/Reports/ProfitAndLoss

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Reports/ProfitAndLoss?fromDate=2013-10-20&toDate=2013-10-20&periods=3&timeframe=MONTH&trackingCategoryID=00000000-0000-0000-0000-000000000000&trackingCategoryID2=00000000-0000-0000-0000-000000000000&trackingOptionID=00000000-0000-0000-0000-000000000000&trackingOptionID2=00000000-0000-0000-0000-000000000000&standardLayout=true&paymentsOnly=false"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        date fromDate = 2013-10-20;
        date toDate = 2013-10-20;
        Integer periods = 3;
        String timeframe = 'MONTH';
        String trackingCategoryID = '00000000-0000-0000-0000-000000000000';
        String trackingCategoryID2 = '00000000-0000-0000-0000-000000000000';
        String trackingOptionID = '00000000-0000-0000-0000-000000000000';
        String trackingOptionID2 = '00000000-0000-0000-0000-000000000000';
        Boolean standardLayout = true;
        Boolean paymentsOnly = false;

        try {
            ReportWithRows result = apiInstance.getReportProfitAndLoss(accessToken, xeroTenantId, fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReportProfitAndLoss");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        date fromDate = 2013-10-20; // date | filter by the from date of the report e.g. 2021-02-01
        date toDate = 2013-10-20; // date | filter by the to date of the report e.g. 2021-02-28
        Integer periods = 3; // Integer | The number of periods to compare (integer between 1 and 12)
        String timeframe = MONTH; // String | The period size to compare to (MONTH, QUARTER, YEAR)
        String trackingCategoryID = 00000000-0000-0000-0000-000000000000; // String | The trackingCategory 1 for the ProfitAndLoss report
        String trackingCategoryID2 = 00000000-0000-0000-0000-000000000000; // String | The trackingCategory 2 for the ProfitAndLoss report
        String trackingOptionID = 00000000-0000-0000-0000-000000000000; // String | The tracking option 1 for the ProfitAndLoss report
        String trackingOptionID2 = 00000000-0000-0000-0000-000000000000; // String | The tracking option 2 for the ProfitAndLoss report
        Boolean standardLayout = true; // Boolean | Return the standard layout for the ProfitAndLoss report
        Boolean paymentsOnly = false; // Boolean | Return cash only basis for the ProfitAndLoss report
        try {
            ReportWithRows result = apiInstance.getReportProfitAndLoss(xeroTenantId, fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReportProfitAndLoss");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
date *fromDate = 2013-10-20; // filter by the from date of the report e.g. 2021-02-01 (optional) (default to null)
date *toDate = 2013-10-20; // filter by the to date of the report e.g. 2021-02-28 (optional) (default to null)
Integer *periods = 3; // The number of periods to compare (integer between 1 and 12) (optional) (default to null)
String *timeframe = MONTH; // The period size to compare to (MONTH, QUARTER, YEAR) (optional) (default to null)
String *trackingCategoryID = 00000000-0000-0000-0000-000000000000; // The trackingCategory 1 for the ProfitAndLoss report (optional) (default to null)
String *trackingCategoryID2 = 00000000-0000-0000-0000-000000000000; // The trackingCategory 2 for the ProfitAndLoss report (optional) (default to null)
String *trackingOptionID = 00000000-0000-0000-0000-000000000000; // The tracking option 1 for the ProfitAndLoss report (optional) (default to null)
String *trackingOptionID2 = 00000000-0000-0000-0000-000000000000; // The tracking option 2 for the ProfitAndLoss report (optional) (default to null)
Boolean *standardLayout = true; // Return the standard layout for the ProfitAndLoss report (optional) (default to null)
Boolean *paymentsOnly = false; // Return cash only basis for the ProfitAndLoss report (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves report for profit and loss
[apiInstance getReportProfitAndLossWith:xeroTenantId
    fromDate:fromDate
    toDate:toDate
    periods:periods
    timeframe:timeframe
    trackingCategoryID:trackingCategoryID
    trackingCategoryID2:trackingCategoryID2
    trackingOptionID:trackingOptionID
    trackingOptionID2:trackingOptionID2
    standardLayout:standardLayout
    paymentsOnly:paymentsOnly
              completionHandler: ^(ReportWithRows output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const fromDate: Date = new Date("2013-10-20");
const toDate: Date = new Date("2013-10-20");
const periods = 3;
const timeframe = 'MONTH';
const trackingCategoryID = '00000000-0000-0000-0000-000000000000';
const trackingCategoryID2 = '00000000-0000-0000-0000-000000000000';
const trackingOptionID = '00000000-0000-0000-0000-000000000000';
const trackingOptionID2 = '00000000-0000-0000-0000-000000000000';
const standardLayout = true;
const paymentsOnly = false;

try {
  const response = await xero.accountingApi.getReportProfitAndLoss(xeroTenantId,  fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetReportProfitAndLossExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var fromDate = DateTime.Parse("2013-10-20");
            var toDate = DateTime.Parse("2013-10-20");
            var periods = 3;
            var timeframe = "MONTH";
            var trackingCategoryID = "00000000-0000-0000-0000-000000000000";
            var trackingCategoryID2 = "00000000-0000-0000-0000-000000000000";
            var trackingOptionID = "00000000-0000-0000-0000-000000000000";
            var trackingOptionID2 = "00000000-0000-0000-0000-000000000000";
            var standardLayout = true;
            var paymentsOnly = false;
            
            try {
                var result = await apiInstance.GetReportProfitAndLossAsync(accessToken, xeroTenantId, fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetReportProfitAndLoss: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$fromDate = new DateTime("2013-10-20");
$toDate = new DateTime("2013-10-20");
$periods = 3;
$timeframe = "MONTH";
$trackingCategoryID = "00000000-0000-0000-0000-000000000000";
$trackingCategoryID2 = "00000000-0000-0000-0000-000000000000";
$trackingOptionID = "00000000-0000-0000-0000-000000000000";
$trackingOptionID2 = "00000000-0000-0000-0000-000000000000";
$standardLayout = true;
$paymentsOnly = false;

try {
  $result = $apiInstance->getReportProfitAndLoss($xeroTenantId, $fromDate, $toDate, $periods, $timeframe, $trackingCategoryID, $trackingCategoryID2, $trackingOptionID, $trackingOptionID2, $standardLayout, $paymentsOnly);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReportProfitAndLoss: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $fromDate = 2013-10-20; # date | filter by the from date of the report e.g. 2021-02-01
my $toDate = 2013-10-20; # date | filter by the to date of the report e.g. 2021-02-28
my $periods = 3; # Integer | The number of periods to compare (integer between 1 and 12)
my $timeframe = MONTH; # String | The period size to compare to (MONTH, QUARTER, YEAR)
my $trackingCategoryID = 00000000-0000-0000-0000-000000000000; # String | The trackingCategory 1 for the ProfitAndLoss report
my $trackingCategoryID2 = 00000000-0000-0000-0000-000000000000; # String | The trackingCategory 2 for the ProfitAndLoss report
my $trackingOptionID = 00000000-0000-0000-0000-000000000000; # String | The tracking option 1 for the ProfitAndLoss report
my $trackingOptionID2 = 00000000-0000-0000-0000-000000000000; # String | The tracking option 2 for the ProfitAndLoss report
my $standardLayout = true; # Boolean | Return the standard layout for the ProfitAndLoss report
my $paymentsOnly = false; # Boolean | Return cash only basis for the ProfitAndLoss report

eval { 
    my $result = $api_instance->getReportProfitAndLoss(xeroTenantId => $xeroTenantId, fromDate => $fromDate, toDate => $toDate, periods => $periods, timeframe => $timeframe, trackingCategoryID => $trackingCategoryID, trackingCategoryID2 => $trackingCategoryID2, trackingOptionID => $trackingOptionID, trackingOptionID2 => $trackingOptionID2, standardLayout => $standardLayout, paymentsOnly => $paymentsOnly);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReportProfitAndLoss: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_report_profit_and_loss():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    from_date = dateutil.parser.parse("2013-10-20")
    to_date = dateutil.parser.parse("2013-10-20")
    time_frame = 'MONTH'
    tracking_category_id = '00000000-0000-0000-0000-000000000000'
    tracking_category_id_2 = '00000000-0000-0000-0000-000000000000'
    tracking_option_id = '00000000-0000-0000-0000-000000000000'
    tracking_option_id_2 = '00000000-0000-0000-0000-000000000000'
    standard_layout = 'true'
    payments_only = 'false'
    
    try:
        api_response = api_instance.get_report_profit_and_loss(xero_tenant_id, from_date, to_date, periods, time_frame, tracking_category_id, tracking_category_id_2, tracking_option_id, tracking_option_id_2, standard_layout, payments_only)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReportProfitAndLoss: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let fromDate = 2013-10-20; // date
    let toDate = 2013-10-20; // date
    let periods = 3; // Integer
    let timeframe = MONTH; // String
    let trackingCategoryID = 00000000-0000-0000-0000-000000000000; // String
    let trackingCategoryID2 = 00000000-0000-0000-0000-000000000000; // String
    let trackingOptionID = 00000000-0000-0000-0000-000000000000; // String
    let trackingOptionID2 = 00000000-0000-0000-0000-000000000000; // String
    let standardLayout = true; // Boolean
    let paymentsOnly = false; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.getReportProfitAndLoss(xeroTenantId, fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.reports.read Grant read-only access to accounting reports

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
fromDate
date (date)
filter by the from date of the report e.g. 2021-02-01
toDate
date (date)
filter by the to date of the report e.g. 2021-02-28
periods
Integer
The number of periods to compare (integer between 1 and 12)
timeframe
String
The period size to compare to (MONTH, QUARTER, YEAR)
trackingCategoryID
String
The trackingCategory 1 for the ProfitAndLoss report
trackingCategoryID2
String
The trackingCategory 2 for the ProfitAndLoss report
trackingOptionID
String
The tracking option 1 for the ProfitAndLoss report
trackingOptionID2
String
The tracking option 2 for the ProfitAndLoss report
standardLayout
Boolean
Return the standard layout for the ProfitAndLoss report
paymentsOnly
Boolean
Return cash only basis for the ProfitAndLoss report

getReportTenNinetyNine

Retrieve reports for 1099


/Reports/TenNinetyNine

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Reports/TenNinetyNine?reportYear=2019"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        String reportYear = '2019';

        try {
            Reports result = apiInstance.getReportTenNinetyNine(accessToken, xeroTenantId, reportYear);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReportTenNinetyNine");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        String reportYear = 2019; // String | The year of the 1099 report
        try {
            Reports result = apiInstance.getReportTenNinetyNine(xeroTenantId, reportYear);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReportTenNinetyNine");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
String *reportYear = 2019; // The year of the 1099 report (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieve reports for 1099
[apiInstance getReportTenNinetyNineWith:xeroTenantId
    reportYear:reportYear
              completionHandler: ^(Reports output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const reportYear = '2019';

try {
  const response = await xero.accountingApi.getReportTenNinetyNine(xeroTenantId,  reportYear);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetReportTenNinetyNineExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var reportYear = "2019";
            
            try {
                var result = await apiInstance.GetReportTenNinetyNineAsync(accessToken, xeroTenantId, reportYear);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetReportTenNinetyNine: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$reportYear = "2019";

try {
  $result = $apiInstance->getReportTenNinetyNine($xeroTenantId, $reportYear);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReportTenNinetyNine: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $reportYear = 2019; # String | The year of the 1099 report

eval { 
    my $result = $api_instance->getReportTenNinetyNine(xeroTenantId => $xeroTenantId, reportYear => $reportYear);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReportTenNinetyNine: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_report_ten_ninety_nine():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    report_year = '2019'
    
    try:
        api_response = api_instance.get_report_ten_ninety_nine(xero_tenant_id, report_year)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReportTenNinetyNine: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let reportYear = 2019; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getReportTenNinetyNine(xeroTenantId, reportYear, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.reports.tenninetynine.read Grant read-only access to 1099 reports

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
reportYear
String
The year of the 1099 report

getReportTrialBalance

Retrieves report for trial balance


/Reports/TrialBalance

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Reports/TrialBalance?date=2019-10-31&paymentsOnly=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        date date = 2019-10-31;
        Boolean paymentsOnly = true;

        try {
            ReportWithRows result = apiInstance.getReportTrialBalance(accessToken, xeroTenantId, date, paymentsOnly);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getReportTrialBalance");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        date date = 2019-10-31; // date | The date for the Trial Balance report e.g. 2018-03-31
        Boolean paymentsOnly = true; // Boolean | Return cash only basis for the Trial Balance report
        try {
            ReportWithRows result = apiInstance.getReportTrialBalance(xeroTenantId, date, paymentsOnly);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getReportTrialBalance");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
date *date = 2019-10-31; // The date for the Trial Balance report e.g. 2018-03-31 (optional) (default to null)
Boolean *paymentsOnly = true; // Return cash only basis for the Trial Balance report (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves report for trial balance
[apiInstance getReportTrialBalanceWith:xeroTenantId
    date:date
    paymentsOnly:paymentsOnly
              completionHandler: ^(ReportWithRows output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const date: Date = new Date("2019-10-31");
const paymentsOnly = true;

try {
  const response = await xero.accountingApi.getReportTrialBalance(xeroTenantId,  date, paymentsOnly);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetReportTrialBalanceExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var date = DateTime.Parse("2019-10-31");
            var paymentsOnly = true;
            
            try {
                var result = await apiInstance.GetReportTrialBalanceAsync(accessToken, xeroTenantId, date, paymentsOnly);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetReportTrialBalance: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$date = new DateTime("2019-10-31");
$paymentsOnly = true;

try {
  $result = $apiInstance->getReportTrialBalance($xeroTenantId, $date, $paymentsOnly);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getReportTrialBalance: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $date = 2019-10-31; # date | The date for the Trial Balance report e.g. 2018-03-31
my $paymentsOnly = true; # Boolean | Return cash only basis for the Trial Balance report

eval { 
    my $result = $api_instance->getReportTrialBalance(xeroTenantId => $xeroTenantId, date => $date, paymentsOnly => $paymentsOnly);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getReportTrialBalance: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_report_trial_balance():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    date = dateutil.parser.parse("2019-10-31")
    payments_only = 'true'
    
    try:
        api_response = api_instance.get_report_trial_balance(xero_tenant_id, date, payments_only)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getReportTrialBalance: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let date = 2019-10-31; // date
    let paymentsOnly = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.getReportTrialBalance(xeroTenantId, date, paymentsOnly, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.reports.read Grant read-only access to accounting reports

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
date
date (date)
The date for the Trial Balance report e.g. 2018-03-31
paymentsOnly
Boolean
Return cash only basis for the Trial Balance report

getTaxRates

Retrieves tax rates


/TaxRates

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/TaxRates?where=Status=="ACTIVE"&order=Name ASC&TaxType=INPUT"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        String where = 'Status=="ACTIVE"';
        String order = 'Name ASC';
        String taxType = 'INPUT';

        try {
            TaxRates result = apiInstance.getTaxRates(accessToken, xeroTenantId, where, order, taxType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getTaxRates");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        String where = Status=="ACTIVE"; // String | Filter by an any element
        String order = Name ASC; // String | Order by an any element
        String taxType = INPUT; // String | Filter by tax type
        try {
            TaxRates result = apiInstance.getTaxRates(xeroTenantId, where, order, taxType);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getTaxRates");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
String *where = Status=="ACTIVE"; // Filter by an any element (optional) (default to null)
String *order = Name ASC; // Order by an any element (optional) (default to null)
String *taxType = INPUT; // Filter by tax type (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves tax rates
[apiInstance getTaxRatesWith:xeroTenantId
    where:where
    order:order
    taxType:taxType
              completionHandler: ^(TaxRates output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const where = 'Status=="ACTIVE"';
const order = 'Name ASC';
const taxType = 'INPUT';

try {
  const response = await xero.accountingApi.getTaxRates(xeroTenantId,  where, order, taxType);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetTaxRatesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var where = "Status==\"ACTIVE\"";
            var order = "Name ASC";
            var taxType = "INPUT";
            
            try {
                var result = await apiInstance.GetTaxRatesAsync(accessToken, xeroTenantId, where, order, taxType);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetTaxRates: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\TaxRate::STATUS_ACTIVE . '"";
$order = "Name ASC";
$taxType = "INPUT";

try {
  $result = $apiInstance->getTaxRates($xeroTenantId, $where, $order, $taxType);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getTaxRates: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $where = Status=="ACTIVE"; # String | Filter by an any element
my $order = Name ASC; # String | Order by an any element
my $taxType = INPUT; # String | Filter by tax type

eval { 
    my $result = $api_instance->getTaxRates(xeroTenantId => $xeroTenantId, where => $where, order => $order, taxType => $taxType);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getTaxRates: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_tax_rates():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    where = 'Status=="ACTIVE"'
    order = 'Name ASC'
    tax_type = 'INPUT'
    
    try:
        api_response = api_instance.get_tax_rates(xero_tenant_id, where, order, tax_type)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getTaxRates: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let where = Status=="ACTIVE"; // String
    let order = Name ASC; // String
    let taxType = INPUT; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getTaxRates(xeroTenantId, where, order, taxType, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element
TaxType
String
Filter by tax type

getTrackingCategories

Retrieves tracking categories and options


/TrackingCategories

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/TrackingCategories?where=Status=="ACTIVE"&order=Name ASC&includeArchived=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        String where = 'Status=="ACTIVE"';
        String order = 'Name ASC';
        Boolean includeArchived = true;

        try {
            TrackingCategories result = apiInstance.getTrackingCategories(accessToken, xeroTenantId, where, order, includeArchived);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getTrackingCategories");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        String where = Status=="ACTIVE"; // String | Filter by an any element
        String order = Name ASC; // String | Order by an any element
        Boolean includeArchived = true; // Boolean | e.g. includeArchived=true - Categories and options with a status of ARCHIVED will be included in the response
        try {
            TrackingCategories result = apiInstance.getTrackingCategories(xeroTenantId, where, order, includeArchived);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getTrackingCategories");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
String *where = Status=="ACTIVE"; // Filter by an any element (optional) (default to null)
String *order = Name ASC; // Order by an any element (optional) (default to null)
Boolean *includeArchived = true; // e.g. includeArchived=true - Categories and options with a status of ARCHIVED will be included in the response (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves tracking categories and options
[apiInstance getTrackingCategoriesWith:xeroTenantId
    where:where
    order:order
    includeArchived:includeArchived
              completionHandler: ^(TrackingCategories output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const where = 'Status=="ACTIVE"';
const order = 'Name ASC';
const includeArchived = true;

try {
  const response = await xero.accountingApi.getTrackingCategories(xeroTenantId,  where, order, includeArchived);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetTrackingCategoriesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var where = "Status==\"ACTIVE\"";
            var order = "Name ASC";
            var includeArchived = true;
            
            try {
                var result = await apiInstance.GetTrackingCategoriesAsync(accessToken, xeroTenantId, where, order, includeArchived);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetTrackingCategories: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$where = "Status=="' . \XeroAPI\XeroPHP\Models\Accounting\TrackingCategory::STATUS_ACTIVE . '"";
$order = "Name ASC";
$includeArchived = true;

try {
  $result = $apiInstance->getTrackingCategories($xeroTenantId, $where, $order, $includeArchived);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getTrackingCategories: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $where = Status=="ACTIVE"; # String | Filter by an any element
my $order = Name ASC; # String | Order by an any element
my $includeArchived = true; # Boolean | e.g. includeArchived=true - Categories and options with a status of ARCHIVED will be included in the response

eval { 
    my $result = $api_instance->getTrackingCategories(xeroTenantId => $xeroTenantId, where => $where, order => $order, includeArchived => $includeArchived);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getTrackingCategories: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_tracking_categories():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    where = 'Status=="ACTIVE"'
    order = 'Name ASC'
    include_archived = 'true'
    
    try:
        api_response = api_instance.get_tracking_categories(xero_tenant_id, where, order, include_archived)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getTrackingCategories: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let where = Status=="ACTIVE"; // String
    let order = Name ASC; // String
    let includeArchived = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.getTrackingCategories(xeroTenantId, where, order, includeArchived, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element
includeArchived
Boolean
e.g. includeArchived=true - Categories and options with a status of ARCHIVED will be included in the response

getTrackingCategory

Retrieves specific tracking categories and options using a unique tracking category Id


/TrackingCategories/{TrackingCategoryID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/TrackingCategories/{TrackingCategoryID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID trackingCategoryID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            TrackingCategories result = apiInstance.getTrackingCategory(accessToken, xeroTenantId, trackingCategoryID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getTrackingCategory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID trackingCategoryID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a TrackingCategory
        try {
            TrackingCategories result = apiInstance.getTrackingCategory(xeroTenantId, trackingCategoryID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getTrackingCategory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *trackingCategoryID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a TrackingCategory (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves specific tracking categories and options using a unique tracking category Id
[apiInstance getTrackingCategoryWith:xeroTenantId
    trackingCategoryID:trackingCategoryID
              completionHandler: ^(TrackingCategories output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const trackingCategoryID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getTrackingCategory(xeroTenantId, trackingCategoryID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetTrackingCategoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var trackingCategoryID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetTrackingCategoryAsync(accessToken, xeroTenantId, trackingCategoryID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetTrackingCategory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$trackingCategoryID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getTrackingCategory($xeroTenantId, $trackingCategoryID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getTrackingCategory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $trackingCategoryID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a TrackingCategory

eval { 
    my $result = $api_instance->getTrackingCategory(xeroTenantId => $xeroTenantId, trackingCategoryID => $trackingCategoryID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getTrackingCategory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_tracking_category():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    tracking_category_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_tracking_category(xero_tenant_id, tracking_category_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getTrackingCategory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let trackingCategoryID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getTrackingCategory(xeroTenantId, trackingCategoryID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Path parameters
Name Description
TrackingCategoryID*
UUID (uuid)
Unique identifier for a TrackingCategory
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getUser

Retrieves a specific user


/Users/{UserID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Users/{UserID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID userID = UUID.fromString("00000000-0000-0000-0000-000000000000");

        try {
            Users result = apiInstance.getUser(accessToken, xeroTenantId, userID);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getUser");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID userID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a User
        try {
            Users result = apiInstance.getUser(xeroTenantId, userID);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getUser");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *userID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a User (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves a specific user
[apiInstance getUserWith:xeroTenantId
    userID:userID
              completionHandler: ^(Users output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const userID = '00000000-0000-0000-0000-000000000000';

try {
  const response = await xero.accountingApi.getUser(xeroTenantId, userID);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetUserExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var userID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            
            try {
                var result = await apiInstance.GetUserAsync(accessToken, xeroTenantId, userID);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetUser: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$userID = "00000000-0000-0000-0000-000000000000";

try {
  $result = $apiInstance->getUser($xeroTenantId, $userID);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getUser: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $userID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a User

eval { 
    my $result = $api_instance->getUser(xeroTenantId => $xeroTenantId, userID => $userID);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getUser: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_user():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    user_id = '00000000-0000-0000-0000-000000000000'
    
    try:
        api_response = api_instance.get_user(xero_tenant_id, user_id)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getUser: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let userID = 00000000-0000-0000-0000-000000000000; // UUID

    let mut context = AccountingApi::Context::default();
    let result = client.getUser(xeroTenantId, userID, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Path parameters
Name Description
UserID*
UUID (uuid)
Unique identifier for a User
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required

getUsers

Retrieves users


/Users

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Users?where=IsSubscriber==true&order=LastName ASC"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';

        OffsetDateTime ifModifiedSince = OffsetDateTime.parse("2020-02-06T12:17:43.202-08:00");
        String where = 'IsSubscriber==true';
        String order = 'LastName ASC';

        try {
            Users result = apiInstance.getUsers(accessToken, xeroTenantId, ifModifiedSince, where, order);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#getUsers");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Date ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date | Only records created or modified since this timestamp will be returned
        String where = IsSubscriber==true; // String | Filter by an any element
        String order = LastName ASC; // String | Order by an any element
        try {
            Users result = apiInstance.getUsers(xeroTenantId, ifModifiedSince, where, order);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#getUsers");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Date *ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Only records created or modified since this timestamp will be returned (optional) (default to null)
String *where = IsSubscriber==true; // Filter by an any element (optional) (default to null)
String *order = LastName ASC; // Order by an any element (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Retrieves users
[apiInstance getUsersWith:xeroTenantId
    ifModifiedSince:ifModifiedSince
    where:where
    order:order
              completionHandler: ^(Users output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const ifModifiedSince: Date = new Date("2020-02-06T12:17:43.202-08:00");
const where = 'IsSubscriber==true';
const order = 'LastName ASC';

try {
  const response = await xero.accountingApi.getUsers(xeroTenantId, ifModifiedSince, where, order);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class GetUsersExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var ifModifiedSince = DateTime.Parse("2020-02-06T12:17:43.202-08:00");
            var where = "IsSubscriber==true";
            var order = "LastName ASC";
            
            try {
                var result = await apiInstance.GetUsersAsync(accessToken, xeroTenantId, ifModifiedSince, where, order);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.GetUsers: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$ifModifiedSince = new DateTime("2020-02-06T12:17:43.202-08:00");
$where = "IsSubscriber==true";
$order = "LastName ASC";

try {
  $result = $apiInstance->getUsers($xeroTenantId, $ifModifiedSince, $where, $order);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->getUsers: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $ifModifiedSince = 2020-02-06T12:17:43.202-08:00; # Date | Only records created or modified since this timestamp will be returned
my $where = IsSubscriber==true; # String | Filter by an any element
my $order = LastName ASC; # String | Order by an any element

eval { 
    my $result = $api_instance->getUsers(xeroTenantId => $xeroTenantId, ifModifiedSince => $ifModifiedSince, where => $where, order => $order);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->getUsers: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_get_users():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    if_modified_since = dateutil.parser.parse("2020-02-06T12:17:43.202-08:00")
    where = 'IsSubscriber==true'
    order = 'LastName ASC'
    
    try:
        api_response = api_instance.get_users(xero_tenant_id, if_modified_since, where, order)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->getUsers: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let ifModifiedSince = 2020-02-06T12:17:43.202-08:00; // Date
    let where = IsSubscriber==true; // String
    let order = LastName ASC; // String

    let mut context = AccountingApi::Context::default();
    let result = client.getUsers(xeroTenantId, ifModifiedSince, where, order, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings.read Grant read-only access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
If-Modified-Since
Date (date-time)
Only records created or modified since this timestamp will be returned
Query parameters
Name Description
where
String
Filter by an any element
order
String
Order by an any element

postSetup

Sets the chart of accounts, the conversion date and conversion balances


/Setup

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Setup"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        
        Account account = new Account();
        account.setCode("123");
        account.setName("Business supplies");
        account.setType(com.xero.models.accounting.AccountType.EXPENSE);

        List<Account> accounts = new ArrayList<Account>();
        accounts.add(account);
        
        ConversionDate conversionDate = new ConversionDate();
        conversionDate.setMonth(10);
        conversionDate.setYear(2020);

        List<ConversionBalances> conversionBalances = new ArrayList<ConversionBalances>();
        
        Setup setup = new Setup();
        setup.setAccounts(accounts);
        setup.setConversionDate(conversionDate);
        setup.setConversionBalances(conversionBalances);

        try {
            ImportSummaryObject result = apiInstance.postSetup(accessToken, xeroTenantId, setup);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#postSetup");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Setup setup = { "ConversionDate": {}, "ConversionBalances": [], "Accounts": [ { "Code": "200", "Name": "Sales", "Type": "SALES", "ReportingCode": "REV.TRA.GOO" }, { "Code": "400", "Name": "Advertising", "Type": "OVERHEADS", "ReportingCode": "EXP" }, { "Code": "610", "Name": "Accounts Receivable", "Type": "CURRENT", "SystemAccount": "DEBTORS", "ReportingCode": "ASS.CUR.REC.TRA" }, { "Code": "800", "Name": "Accounts Payable", "Type": "CURRLIAB", "SystemAccount": "CREDITORS", "ReportingCode": "LIA.CUR.PAY" } ] }; // Setup | 
        try {
            ImportSummaryObject result = apiInstance.postSetup(xeroTenantId, setup);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#postSetup");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Setup *setup = { "ConversionDate": {}, "ConversionBalances": [], "Accounts": [ { "Code": "200", "Name": "Sales", "Type": "SALES", "ReportingCode": "REV.TRA.GOO" }, { "Code": "400", "Name": "Advertising", "Type": "OVERHEADS", "ReportingCode": "EXP" }, { "Code": "610", "Name": "Accounts Receivable", "Type": "CURRENT", "SystemAccount": "DEBTORS", "ReportingCode": "ASS.CUR.REC.TRA" }, { "Code": "800", "Name": "Accounts Payable", "Type": "CURRLIAB", "SystemAccount": "CREDITORS", "ReportingCode": "LIA.CUR.PAY" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Sets the chart of accounts, the conversion date and conversion balances
[apiInstance postSetupWith:xeroTenantId
    setup:setup
              completionHandler: ^(ImportSummaryObject output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';

const account: Account = { 
    code: "123",
    name: "Business supplies",
    type: AccountType.EXPENSE };   
const accounts = [];    
accounts.push(account)

const conversionDate: ConversionDate = { 
    month: 10,
    year: 2020 };   
const conversionBalances = [];

const setup: Setup = { 
    accounts: accounts,
    conversionDate: conversionDate,
    conversionBalances: conversionBalances }; 

try {
  const response = await xero.accountingApi.postSetup(xeroTenantId, setup);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class PostSetupExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";

            var account = new Account();
            account.Code = "123";
            account.Name = "Business supplies";
            account.Type = AccountType.EXPENSE;
            var accounts = new List<Account>();
            accounts.Add(account);

            var conversionDate = new ConversionDate();
            conversionDate.Month = 10;
            conversionDate.Year = 2020;
            var conversionBalances = new List<ConversionBalances>();

            var setup = new Setup();
            setup.Accounts = accounts;
            setup.ConversionDate = conversionDate;
            setup.ConversionBalances = conversionBalances;
            
            try {
                var result = await apiInstance.PostSetupAsync(accessToken, xeroTenantId, setup);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.PostSetup: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

$account = new XeroAPI\XeroPHP\Models\Accounting\Account;
$account->setCode('123');
$account->setName('Business supplies');
$account->setType(XeroAPI\XeroPHP\Models\Accounting\AccountType::EXPENSE);
$accounts = [];
array_push($accounts, $account);

$conversionDate = new XeroAPI\XeroPHP\Models\Accounting\ConversionDate;
$conversionDate->setMonth(10);
$conversionDate->setYear(2020);
$conversionBalances = [];

$setup = new XeroAPI\XeroPHP\Models\Accounting\Setup;
$setup->setAccounts($accounts);
$setup->setConversionDate($conversionDate);
$setup->setConversionBalances($conversionBalances);

try {
  $result = $apiInstance->postSetup($xeroTenantId, $setup);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->postSetup: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $setup = ::Object::Setup->new(); # Setup | 

eval { 
    my $result = $api_instance->postSetup(xeroTenantId => $xeroTenantId, setup => $setup);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->postSetup: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_post_setup():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'

    account = Account(
        code = "123",
        name = "Business supplies",
        type = AccountType.EXPENSE)
    
    accounts = []    
    accounts.append(account)

    conversion_date = ConversionDate(
        month = 10,
        year = 2020)
    
    conversion_balances = []

    setup = Setup(
        accounts = accounts,
        conversion_date = conversion_date,
        conversion_balances = conversion_balances)
    
    try:
        api_response = api_instance.post_setup(xero_tenant_id, setup)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->postSetup: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let setup = { "ConversionDate": {}, "ConversionBalances": [], "Accounts": [ { "Code": "200", "Name": "Sales", "Type": "SALES", "ReportingCode": "REV.TRA.GOO" }, { "Code": "400", "Name": "Advertising", "Type": "OVERHEADS", "ReportingCode": "EXP" }, { "Code": "610", "Name": "Accounts Receivable", "Type": "CURRENT", "SystemAccount": "DEBTORS", "ReportingCode": "ASS.CUR.REC.TRA" }, { "Code": "800", "Name": "Accounts Payable", "Type": "CURRLIAB", "SystemAccount": "CREDITORS", "ReportingCode": "LIA.CUR.PAY" } ] }; // Setup

    let mut context = AccountingApi::Context::default();
    let result = client.postSetup(xeroTenantId, setup, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
setup *
Setup
Object including an accounts array, a conversion balances array and a conversion date object in body of request
Required

updateAccount

Updates a chart of accounts


/Accounts/{AccountID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Accounts/{AccountID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID accountID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        Account account = new Account();
        account.setCode("123456");
        account.setName("BarFoo");
        account.setType(com.xero.models.accounting.AccountType.EXPENSE);
        account.setDescription("Hello World");
        account.setTaxType("NONE");
        
        Accounts accounts = new Accounts();
        accounts.addAccountsItem(account);

        try {
            Accounts result = apiInstance.updateAccount(accessToken, xeroTenantId, accountID, accounts);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateAccount");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID accountID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Account object
        Accounts accounts = { "Accounts":[ { "Code":"123456", "Name":"BarFoo", "AccountID":"99ce6032-0678-4aa0-8148-240c75fee33a", "Type":"EXPENSE", "Description":"GoodBye World", "TaxType":"INPUT", "EnablePaymentsToAccount":false, "ShowInExpenseClaims":false, "Class":"EXPENSE", "ReportingCode":"EXP", "ReportingCodeName":"Expense", "UpdatedDateUTC":"2019-02-21T16:29:47.96-08:00" } ] }; // Accounts | 
        try {
            Accounts result = apiInstance.updateAccount(xeroTenantId, accountID, accounts);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateAccount");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *accountID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Account object (default to null)
Accounts *accounts = { "Accounts":[ { "Code":"123456", "Name":"BarFoo", "AccountID":"99ce6032-0678-4aa0-8148-240c75fee33a", "Type":"EXPENSE", "Description":"GoodBye World", "TaxType":"INPUT", "EnablePaymentsToAccount":false, "ShowInExpenseClaims":false, "Class":"EXPENSE", "ReportingCode":"EXP", "ReportingCodeName":"Expense", "UpdatedDateUTC":"2019-02-21T16:29:47.96-08:00" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a chart of accounts
[apiInstance updateAccountWith:xeroTenantId
    accountID:accountID
    accounts:accounts
              completionHandler: ^(Accounts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const accountID = '00000000-0000-0000-0000-000000000000';

const account: Account = { 
    code: "123456",
    name: "BarFoo",
    type: AccountType.EXPENSE,
    description: "Hello World",
    taxType: "NONE" }; 

const accounts: Accounts = {  
    accounts: [account] }; 

try {
  const response = await xero.accountingApi.updateAccount(xeroTenantId, accountID, accounts);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateAccountExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var accountID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var account = new Account();
            account.Code = "123456";
            account.Name = "BarFoo";
            account.Type = AccountType.EXPENSE;
            account.Description = "Hello World";
            account.TaxType = "NONE";

            var accounts = new Accounts();
            var accountsList = new List<Account>();
            accountsList.Add(account); 
            accounts._Accounts = accountsList;
            
            try {
                var result = await apiInstance.UpdateAccountAsync(accessToken, xeroTenantId, accountID, accounts);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateAccount: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$accountID = "00000000-0000-0000-0000-000000000000";

$account = new XeroAPI\XeroPHP\Models\Accounting\Account;
$account->setCode('123456');
$account->setName('BarFoo');
$account->setType(XeroAPI\XeroPHP\Models\Accounting\AccountType::EXPENSE);
$account->setDescription('Hello World');
$account->setTaxType('NONE');

$accounts = new XeroAPI\XeroPHP\Models\Accounting\Accounts;
$arr_accounts = [];
array_push($arr_accounts, $account);
$accounts->setAccounts($arr_accounts);

try {
  $result = $apiInstance->updateAccount($xeroTenantId, $accountID, $accounts);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateAccount: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $accountID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Account object
my $accounts = ::Object::Accounts->new(); # Accounts | 

eval { 
    my $result = $api_instance->updateAccount(xeroTenantId => $xeroTenantId, accountID => $accountID, accounts => $accounts);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateAccount: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_account():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    account_id = '00000000-0000-0000-0000-000000000000'

    account = Account(
        code = "123456",
        name = "BarFoo",
        type = AccountType.EXPENSE,
        description = "Hello World",
        tax_type = "NONE")

    accounts = Accounts( 
        accounts = [account])
    
    try:
        api_response = api_instance.update_account(xero_tenant_id, account_id, accounts)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateAccount: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let accountID = 00000000-0000-0000-0000-000000000000; // UUID
    let accounts = { "Accounts":[ { "Code":"123456", "Name":"BarFoo", "AccountID":"99ce6032-0678-4aa0-8148-240c75fee33a", "Type":"EXPENSE", "Description":"GoodBye World", "TaxType":"INPUT", "EnablePaymentsToAccount":false, "ShowInExpenseClaims":false, "Class":"EXPENSE", "ReportingCode":"EXP", "ReportingCodeName":"Expense", "UpdatedDateUTC":"2019-02-21T16:29:47.96-08:00" } ] }; // Accounts

    let mut context = AccountingApi::Context::default();
    let result = client.updateAccount(xeroTenantId, accountID, accounts, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Path parameters
Name Description
AccountID*
UUID (uuid)
Unique identifier for Account object
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
accounts *
Accounts
Request of type Accounts array with one Account
Required

updateAccountAttachmentByFileName

Updates attachment on a specific account by filename


/Accounts/{AccountID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Accounts/{AccountID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID accountID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.updateAccountAttachmentByFileName(accessToken, xeroTenantId, accountID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateAccountAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID accountID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for Account object
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.updateAccountAttachmentByFileName(xeroTenantId, accountID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateAccountAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *accountID = 00000000-0000-0000-0000-000000000000; // Unique identifier for Account object (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates attachment on a specific account by filename
[apiInstance updateAccountAttachmentByFileNameWith:xeroTenantId
    accountID:accountID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const accountID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.updateAccountAttachmentByFileName(xeroTenantId, accountID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateAccountAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var accountID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.UpdateAccountAttachmentByFileNameAsync(accessToken, xeroTenantId, accountID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateAccountAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$accountID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->updateAccountAttachmentByFileName($xeroTenantId, $accountID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateAccountAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $accountID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for Account object
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->updateAccountAttachmentByFileName(xeroTenantId => $xeroTenantId, accountID => $accountID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateAccountAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_account_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    account_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.update_account_attachment_by_file_name(xero_tenant_id, account_id, file_name, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateAccountAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let accountID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.updateAccountAttachmentByFileName(xeroTenantId, accountID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
AccountID*
UUID (uuid)
Unique identifier for Account object
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

updateBankTransaction

Updates a single spent or received money transaction


/BankTransactions/{BankTransactionID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransactions/{BankTransactionID}?unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID bankTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Integer unitdp = 4;
        
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");

        List<LineItem> lineItems = new ArrayList<LineItem>();
        lineItems.add(lineItem);
        
        Account bankAccount = new Account();
        bankAccount.setAccountID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        BankTransaction bankTransaction = new BankTransaction();
        bankTransaction.setReference("You just updated");
        bankTransaction.setType(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE);
        bankTransaction.setContact(contact);
        bankTransaction.setLineItems(lineItems);
        bankTransaction.setBankAccount(bankAccount);
        
        BankTransactions bankTransactions = new BankTransactions();
        bankTransactions.addBankTransactionsItem(bankTransaction);

        try {
            BankTransactions result = apiInstance.updateBankTransaction(accessToken, xeroTenantId, bankTransactionID, bankTransactions, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateBankTransaction");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transaction
        BankTransactions bankTransactions = { "BankTransactions": [ { "Type": "SPEND", "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000", "ContactStatus": "ACTIVE", "Name": "Buzz Lightyear", "FirstName": "Buzz", "LastName": "Lightyear", "EmailAddress": "buzz.Lightyear@email.com", "ContactPersons": [], "BankAccountDetails": "", "Addresses": [ { "AddressType": "STREET", "City": "", "Region": "", "PostalCode": "", "Country": "" }, { "AddressType": "POBOX", "AddressLine1": "", "AddressLine2": "", "AddressLine3": "", "AddressLine4": "", "City": "Palo Alto", "Region": "CA", "PostalCode": "94020", "Country": "United States" } ], "Phones": [ { "PhoneType": "DEFAULT", "PhoneNumber": "847-1294", "PhoneAreaCode": "(626)", "PhoneCountryCode": "" }, { "PhoneType": "DDI", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "FAX", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "MOBILE", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" } ], "UpdatedDateUTC": "2017-08-21T13:49:04.227-07:00", "ContactGroups": [] }, "Lineitems": [], "BankAccount": { "Code": "088", "Name": "Business Wells Fargo", "AccountID": "00000000-0000-0000-0000-000000000000" }, "IsReconciled": false, "Date": "2019-02-25", "Reference": "You just updated", "CurrencyCode": "USD", "CurrencyRate": 1, "Status": "AUTHORISED", "LineAmountTypes": "Inclusive", "TotalTax": 1.74, "BankTransactionID": "00000000-0000-0000-0000-000000000000", "UpdatedDateUTC": "2019-02-26T12:39:27.813-08:00" } ] }; // BankTransactions | 
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            BankTransactions result = apiInstance.updateBankTransaction(xeroTenantId, bankTransactionID, bankTransactions, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateBankTransaction");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransactionID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transaction (default to null)
BankTransactions *bankTransactions = { "BankTransactions": [ { "Type": "SPEND", "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000", "ContactStatus": "ACTIVE", "Name": "Buzz Lightyear", "FirstName": "Buzz", "LastName": "Lightyear", "EmailAddress": "buzz.Lightyear@email.com", "ContactPersons": [], "BankAccountDetails": "", "Addresses": [ { "AddressType": "STREET", "City": "", "Region": "", "PostalCode": "", "Country": "" }, { "AddressType": "POBOX", "AddressLine1": "", "AddressLine2": "", "AddressLine3": "", "AddressLine4": "", "City": "Palo Alto", "Region": "CA", "PostalCode": "94020", "Country": "United States" } ], "Phones": [ { "PhoneType": "DEFAULT", "PhoneNumber": "847-1294", "PhoneAreaCode": "(626)", "PhoneCountryCode": "" }, { "PhoneType": "DDI", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "FAX", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "MOBILE", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" } ], "UpdatedDateUTC": "2017-08-21T13:49:04.227-07:00", "ContactGroups": [] }, "Lineitems": [], "BankAccount": { "Code": "088", "Name": "Business Wells Fargo", "AccountID": "00000000-0000-0000-0000-000000000000" }, "IsReconciled": false, "Date": "2019-02-25", "Reference": "You just updated", "CurrencyCode": "USD", "CurrencyRate": 1, "Status": "AUTHORISED", "LineAmountTypes": "Inclusive", "TotalTax": 1.74, "BankTransactionID": "00000000-0000-0000-0000-000000000000", "UpdatedDateUTC": "2019-02-26T12:39:27.813-08:00" } ] }; // 
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a single spent or received money transaction
[apiInstance updateBankTransactionWith:xeroTenantId
    bankTransactionID:bankTransactionID
    bankTransactions:bankTransactions
    unitdp:unitdp
              completionHandler: ^(BankTransactions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransactionID = '00000000-0000-0000-0000-000000000000';
const unitdp = 4;

const contact: Contact = { 
    contactID: "00000000-0000-0000-0000-000000000000" }; 

const lineItem: LineItem = { 
    description: "Foobar",
    quantity: 1.0,
    unitAmount: 20.0,
    accountCode: "000" };   
const lineItems = [];    
lineItems.push(lineItem)

const bankAccount: Account = { 
    accountID: "00000000-0000-0000-0000-000000000000" }; 

const bankTransaction: BankTransaction = { 
    reference: "You just updated",
    type: BankTransaction.TypeEnum.RECEIVE,
    contact: contact,
    lineItems: lineItems,
    bankAccount: bankAccount }; 

const bankTransactions: BankTransactions = {  
    bankTransactions: [bankTransaction] }; 

try {
  const response = await xero.accountingApi.updateBankTransaction(xeroTenantId, bankTransactionID, bankTransactions,  unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateBankTransactionExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransactionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var unitdp = 4;

            var contact = new Contact();
            contact.ContactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var lineItem = new LineItem();
            lineItem.Description = "Foobar";
            lineItem.Quantity = new decimal(1.0);
            lineItem.UnitAmount = new decimal(20.0);
            lineItem.AccountCode = "000";
            var lineItems = new List<LineItem>();
            lineItems.Add(lineItem);

            var bankAccount = new Account();
            bankAccount.AccountID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var bankTransaction = new BankTransaction();
            bankTransaction.Reference = "You just updated";
            bankTransaction.Type = BankTransaction.TypeEnum.RECEIVE;
            bankTransaction.Contact = contact;
            bankTransaction.LineItems = lineItems;
            bankTransaction.BankAccount = bankAccount;

            var bankTransactions = new BankTransactions();
            var bankTransactionsList = new List<BankTransaction>();
            bankTransactionsList.Add(bankTransaction); 
            bankTransactions._BankTransactions = bankTransactionsList;
            
            try {
                var result = await apiInstance.UpdateBankTransactionAsync(accessToken, xeroTenantId, bankTransactionID, bankTransactions, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateBankTransaction: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransactionID = "00000000-0000-0000-0000-000000000000";
$unitdp = 4;

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItems = [];
array_push($lineItems, $lineItem);

$bankAccount = new XeroAPI\XeroPHP\Models\Accounting\Account;
$bankAccount->setAccountID('00000000-0000-0000-0000-000000000000');

$bankTransaction = new XeroAPI\XeroPHP\Models\Accounting\BankTransaction;
$bankTransaction->setReference('You just updated');
$bankTransaction->setType(XeroAPI\XeroPHP\Models\Accounting\BankTransaction::TYPE_RECEIVE);
$bankTransaction->setContact($contact);
$bankTransaction->setLineItems($lineItems);
$bankTransaction->setBankAccount($bankAccount);

$bankTransactions = new XeroAPI\XeroPHP\Models\Accounting\BankTransactions;
$arr_bank_transactions = [];
array_push($arr_bank_transactions, $bankTransaction);
$bankTransactions->setBankTransactions($arr_bank_transactions);

try {
  $result = $apiInstance->updateBankTransaction($xeroTenantId, $bankTransactionID, $bankTransactions, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateBankTransaction: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transaction
my $bankTransactions = ::Object::BankTransactions->new(); # BankTransactions | 
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->updateBankTransaction(xeroTenantId => $xeroTenantId, bankTransactionID => $bankTransactionID, bankTransactions => $bankTransactions, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateBankTransaction: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_bank_transaction():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transaction_id = '00000000-0000-0000-0000-000000000000'

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000")
    
    line_items = []    
    line_items.append(line_item)

    bank_account = Account(
        account_id = "00000000-0000-0000-0000-000000000000")

    bank_transaction = BankTransaction(
        reference = "You just updated",
        type = "RECEIVE",
        contact = contact,
        lineItems = lineItems,
        bank_account = bank_account)

    bankTransactions = BankTransactions( 
        bank_transactions = [bank_transaction])
    
    try:
        api_response = api_instance.update_bank_transaction(xero_tenant_id, bank_transaction_id, bankTransactions, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateBankTransaction: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID
    let bankTransactions = { "BankTransactions": [ { "Type": "SPEND", "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000", "ContactStatus": "ACTIVE", "Name": "Buzz Lightyear", "FirstName": "Buzz", "LastName": "Lightyear", "EmailAddress": "buzz.Lightyear@email.com", "ContactPersons": [], "BankAccountDetails": "", "Addresses": [ { "AddressType": "STREET", "City": "", "Region": "", "PostalCode": "", "Country": "" }, { "AddressType": "POBOX", "AddressLine1": "", "AddressLine2": "", "AddressLine3": "", "AddressLine4": "", "City": "Palo Alto", "Region": "CA", "PostalCode": "94020", "Country": "United States" } ], "Phones": [ { "PhoneType": "DEFAULT", "PhoneNumber": "847-1294", "PhoneAreaCode": "(626)", "PhoneCountryCode": "" }, { "PhoneType": "DDI", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "FAX", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" }, { "PhoneType": "MOBILE", "PhoneNumber": "", "PhoneAreaCode": "", "PhoneCountryCode": "" } ], "UpdatedDateUTC": "2017-08-21T13:49:04.227-07:00", "ContactGroups": [] }, "Lineitems": [], "BankAccount": { "Code": "088", "Name": "Business Wells Fargo", "AccountID": "00000000-0000-0000-0000-000000000000" }, "IsReconciled": false, "Date": "2019-02-25", "Reference": "You just updated", "CurrencyCode": "USD", "CurrencyRate": 1, "Status": "AUTHORISED", "LineAmountTypes": "Inclusive", "TotalTax": 1.74, "BankTransactionID": "00000000-0000-0000-0000-000000000000", "UpdatedDateUTC": "2019-02-26T12:39:27.813-08:00" } ] }; // BankTransactions
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.updateBankTransaction(xeroTenantId, bankTransactionID, bankTransactions, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
BankTransactionID*
UUID (uuid)
Xero generated unique identifier for a bank transaction
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
bankTransactions *
BankTransactions
Required
Query parameters
Name Description
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

updateBankTransactionAttachmentByFileName

Updates a specific attachment from a specific bank transaction by filename


/BankTransactions/{BankTransactionID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransactions/{BankTransactionID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID bankTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.updateBankTransactionAttachmentByFileName(accessToken, xeroTenantId, bankTransactionID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateBankTransactionAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transaction
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.updateBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateBankTransactionAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransactionID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transaction (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific attachment from a specific bank transaction by filename
[apiInstance updateBankTransactionAttachmentByFileNameWith:xeroTenantId
    bankTransactionID:bankTransactionID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransactionID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.updateBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateBankTransactionAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransactionID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.UpdateBankTransactionAttachmentByFileNameAsync(accessToken, xeroTenantId, bankTransactionID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateBankTransactionAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransactionID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->updateBankTransactionAttachmentByFileName($xeroTenantId, $bankTransactionID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateBankTransactionAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transaction
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->updateBankTransactionAttachmentByFileName(xeroTenantId => $xeroTenantId, bankTransactionID => $bankTransactionID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateBankTransactionAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_bank_transaction_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transaction_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.update_bank_transaction_attachment_by_file_name(xero_tenant_id, bank_transaction_id, file_name, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateBankTransactionAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransactionID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.updateBankTransactionAttachmentByFileName(xeroTenantId, bankTransactionID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
BankTransactionID*
UUID (uuid)
Xero generated unique identifier for a bank transaction
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

updateBankTransferAttachmentByFileName


/BankTransfers/{BankTransferID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransfers/{BankTransferID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID bankTransferID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.updateBankTransferAttachmentByFileName(accessToken, xeroTenantId, bankTransferID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateBankTransferAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID | Xero generated unique identifier for a bank transfer
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.updateBankTransferAttachmentByFileName(xeroTenantId, bankTransferID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateBankTransferAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *bankTransferID = 00000000-0000-0000-0000-000000000000; // Xero generated unique identifier for a bank transfer (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// 
[apiInstance updateBankTransferAttachmentByFileNameWith:xeroTenantId
    bankTransferID:bankTransferID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const bankTransferID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.updateBankTransferAttachmentByFileName(xeroTenantId, bankTransferID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateBankTransferAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var bankTransferID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.UpdateBankTransferAttachmentByFileNameAsync(accessToken, xeroTenantId, bankTransferID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateBankTransferAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$bankTransferID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->updateBankTransferAttachmentByFileName($xeroTenantId, $bankTransferID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateBankTransferAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransferID = 00000000-0000-0000-0000-000000000000; # UUID | Xero generated unique identifier for a bank transfer
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->updateBankTransferAttachmentByFileName(xeroTenantId => $xeroTenantId, bankTransferID => $bankTransferID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateBankTransferAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_bank_transfer_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    bank_transfer_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.update_bank_transfer_attachment_by_file_name(xero_tenant_id, bank_transfer_id, file_name, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateBankTransferAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransferID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.updateBankTransferAttachmentByFileName(xeroTenantId, bankTransferID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
BankTransferID*
UUID (uuid)
Xero generated unique identifier for a bank transfer
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

updateContact

Updates a specific contact in a Xero organisation


/Contacts/{ContactID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts/{ContactID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        Contact contact = new Contact();
        contact.setName("Thanos");
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        Contacts contacts = new Contacts();
        contacts.addContactsItem(contact);

        try {
            Contacts result = apiInstance.updateContact(accessToken, xeroTenantId, contactID, contacts);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateContact");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        Contacts contacts = { "Contacts": [{ "ContactID": "00000000-0000-0000-0000-000000000000", "Name": "Thanos" }]}; // Contacts | 
        try {
            Contacts result = apiInstance.updateContact(xeroTenantId, contactID, contacts);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateContact");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)
Contacts *contacts = { "Contacts": [{ "ContactID": "00000000-0000-0000-0000-000000000000", "Name": "Thanos" }]}; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific contact in a Xero organisation
[apiInstance updateContactWith:xeroTenantId
    contactID:contactID
    contacts:contacts
              completionHandler: ^(Contacts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactID = '00000000-0000-0000-0000-000000000000';

const contact: Contact = { 
    name: "Thanos",
    contactID: "00000000-0000-0000-0000-000000000000" }; 

const contacts: Contacts = {  
    contacts: [contact] }; 

try {
  const response = await xero.accountingApi.updateContact(xeroTenantId, contactID, contacts);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateContactExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var contact = new Contact();
            contact.Name = "Thanos";
            contact.ContactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var contacts = new Contacts();
            var contactsList = new List<Contact>();
            contactsList.Add(contact); 
            contacts._Contacts = contactsList;
            
            try {
                var result = await apiInstance.UpdateContactAsync(accessToken, xeroTenantId, contactID, contacts);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateContact: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactID = "00000000-0000-0000-0000-000000000000";

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setName('Thanos');
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$contacts = new XeroAPI\XeroPHP\Models\Accounting\Contacts;
$arr_contacts = [];
array_push($arr_contacts, $contact);
$contacts->setContacts($arr_contacts);

try {
  $result = $apiInstance->updateContact($xeroTenantId, $contactID, $contacts);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateContact: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact
my $contacts = ::Object::Contacts->new(); # Contacts | 

eval { 
    my $result = $api_instance->updateContact(xeroTenantId => $xeroTenantId, contactID => $contactID, contacts => $contacts);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateContact: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_contact():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    contact_id = '00000000-0000-0000-0000-000000000000'

    contact = Contact(
        name = "Thanos",
        contactID = "00000000-0000-0000-0000-000000000000")

    contacts = Contacts( 
        contacts = [contact])
    
    try:
        api_response = api_instance.update_contact(xero_tenant_id, contact_id, contacts)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateContact: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID
    let contacts = { "Contacts": [{ "ContactID": "00000000-0000-0000-0000-000000000000", "Name": "Thanos" }]}; // Contacts

    let mut context = AccountingApi::Context::default();
    let result = client.updateContact(xeroTenantId, contactID, contacts, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts Grant read-write access to contacts and contact groups

Parameters

Path parameters
Name Description
ContactID*
UUID (uuid)
Unique identifier for a Contact
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
contacts *
Contacts
an array of Contacts containing single Contact object with properties to update
Required

updateContactAttachmentByFileName


/Contacts/{ContactID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts/{ContactID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID contactID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.updateContactAttachmentByFileName(accessToken, xeroTenantId, contactID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateContactAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.updateContactAttachmentByFileName(xeroTenantId, contactID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateContactAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// 
[apiInstance updateContactAttachmentByFileNameWith:xeroTenantId
    contactID:contactID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.updateContactAttachmentByFileName(xeroTenantId, contactID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateContactAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.UpdateContactAttachmentByFileNameAsync(accessToken, xeroTenantId, contactID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateContactAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->updateContactAttachmentByFileName($xeroTenantId, $contactID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateContactAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->updateContactAttachmentByFileName(xeroTenantId => $xeroTenantId, contactID => $contactID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateContactAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_contact_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    contact_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.update_contact_attachment_by_file_name(xero_tenant_id, contact_id, file_name, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateContactAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.updateContactAttachmentByFileName(xeroTenantId, contactID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
ContactID*
UUID (uuid)
Unique identifier for a Contact
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

updateContactGroup

Updates a specific contact group


/ContactGroups/{ContactGroupID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ContactGroups/{ContactGroupID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID contactGroupID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        ContactGroup contactGroup = new ContactGroup();
        contactGroup.setName("Vendor");
        
        ContactGroups contactGroups = new ContactGroups();
        contactGroups.addContactGroupsItem(contactGroup);

        try {
            ContactGroups result = apiInstance.updateContactGroup(accessToken, xeroTenantId, contactGroupID, contactGroups);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateContactGroup");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID contactGroupID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Contact Group
        ContactGroups contactGroups = { "ContactGroups":[ { "Name":"Suppliers" } ] }; // ContactGroups | 
        try {
            ContactGroups result = apiInstance.updateContactGroup(xeroTenantId, contactGroupID, contactGroups);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateContactGroup");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *contactGroupID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Contact Group (default to null)
ContactGroups *contactGroups = { "ContactGroups":[ { "Name":"Suppliers" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific contact group
[apiInstance updateContactGroupWith:xeroTenantId
    contactGroupID:contactGroupID
    contactGroups:contactGroups
              completionHandler: ^(ContactGroups output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const contactGroupID = '00000000-0000-0000-0000-000000000000';

const contactGroup: ContactGroup = { 
    name: "Vendor" }; 

const contactGroups: ContactGroups = {  
    contactGroups: [contactGroup] }; 

try {
  const response = await xero.accountingApi.updateContactGroup(xeroTenantId, contactGroupID, contactGroups);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateContactGroupExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var contactGroupID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var contactGroup = new ContactGroup();
            contactGroup.Name = "Vendor";

            var contactGroups = new ContactGroups();
            var contactGroupsList = new List<ContactGroup>();
            contactGroupsList.Add(contactGroup); 
            contactGroups._ContactGroups = contactGroupsList;
            
            try {
                var result = await apiInstance.UpdateContactGroupAsync(accessToken, xeroTenantId, contactGroupID, contactGroups);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateContactGroup: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$contactGroupID = "00000000-0000-0000-0000-000000000000";

$contactGroup = new XeroAPI\XeroPHP\Models\Accounting\ContactGroup;
$contactGroup->setName('Vendor');

$contactGroups = new XeroAPI\XeroPHP\Models\Accounting\ContactGroups;
$arr_contact_groups = [];
array_push($arr_contact_groups, $contactGroup);
$contactGroups->setContactGroups($arr_contact_groups);

try {
  $result = $apiInstance->updateContactGroup($xeroTenantId, $contactGroupID, $contactGroups);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateContactGroup: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contactGroupID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Contact Group
my $contactGroups = ::Object::ContactGroups->new(); # ContactGroups | 

eval { 
    my $result = $api_instance->updateContactGroup(xeroTenantId => $xeroTenantId, contactGroupID => $contactGroupID, contactGroups => $contactGroups);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateContactGroup: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_contact_group():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    contact_group_id = '00000000-0000-0000-0000-000000000000'

    contact_group = ContactGroup(
        name = "Vendor")

    contactGroups = ContactGroups( 
        contact_groups = [contact_group])
    
    try:
        api_response = api_instance.update_contact_group(xero_tenant_id, contact_group_id, contactGroups)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateContactGroup: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contactGroupID = 00000000-0000-0000-0000-000000000000; // UUID
    let contactGroups = { "ContactGroups":[ { "Name":"Suppliers" } ] }; // ContactGroups

    let mut context = AccountingApi::Context::default();
    let result = client.updateContactGroup(xeroTenantId, contactGroupID, contactGroups, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts Grant read-write access to contacts and contact groups

Parameters

Path parameters
Name Description
ContactGroupID*
UUID (uuid)
Unique identifier for a Contact Group
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
contactGroups *
ContactGroups
an array of Contact groups with Name of specific group to update
Required

updateCreditNote

Updates a specific credit note


/CreditNotes/{CreditNoteID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes/{CreditNoteID}?unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID creditNoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Integer unitdp = 4;
        LocalDate currDate = LocalDate.now();
        
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");

        List<LineItem> lineItems = new ArrayList<LineItem>();
        lineItems.add(lineItem);
        
        CreditNote creditNote = new CreditNote();
        creditNote.setType(com.xero.models.accounting.CreditNote.TypeEnum.ACCPAYCREDIT);
        creditNote.setStatus(com.xero.models.accounting.CreditNote.StatusEnum.AUTHORISED);
        creditNote.setReference("My ref.");
        creditNote.setContact(contact);
        creditNote.setDate(currDate);
        creditNote.setLineItems(lineItems);
        
        CreditNotes creditNotes = new CreditNotes();
        creditNotes.addCreditNotesItem(creditNote);

        try {
            CreditNotes result = apiInstance.updateCreditNote(accessToken, xeroTenantId, creditNoteID, creditNotes, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateCreditNote");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Credit Note
        CreditNotes creditNotes = { "CreditNotes": [ { "Type": "ACCPAYCREDIT", "Contact": { "ContactID": "430fa14a-f945-44d3-9f97-5df5e28441b8" }, "Date": "2019-01-05", "Status": "AUTHORISED", "Reference": "HelloWorld", "LineItems": [ { "Description": "Foobar", "Quantity": 2, "UnitAmount": 20, "AccountCode": "400" } ] } ] }; // CreditNotes | 
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            CreditNotes result = apiInstance.updateCreditNote(xeroTenantId, creditNoteID, creditNotes, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateCreditNote");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *creditNoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Credit Note (default to null)
CreditNotes *creditNotes = { "CreditNotes": [ { "Type": "ACCPAYCREDIT", "Contact": { "ContactID": "430fa14a-f945-44d3-9f97-5df5e28441b8" }, "Date": "2019-01-05", "Status": "AUTHORISED", "Reference": "HelloWorld", "LineItems": [ { "Description": "Foobar", "Quantity": 2, "UnitAmount": 20, "AccountCode": "400" } ] } ] }; // 
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific credit note
[apiInstance updateCreditNoteWith:xeroTenantId
    creditNoteID:creditNoteID
    creditNotes:creditNotes
    unitdp:unitdp
              completionHandler: ^(CreditNotes output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const creditNoteID = '00000000-0000-0000-0000-000000000000';
const unitdp = 4;
const currDate = '2020-12-10'

const contact: Contact = { 
    contactID: "00000000-0000-0000-0000-000000000000" }; 

const lineItem: LineItem = { 
    description: "Foobar",
    quantity: 1.0,
    unitAmount: 20.0,
    accountCode: "000" };   
const lineItems = [];    
lineItems.push(lineItem)

const creditNote: CreditNote = { 
    type: CreditNote.TypeEnum.ACCPAYCREDIT,
    status: CreditNote.StatusEnum.AUTHORISED,
    reference: "My ref.",
    contact: contact,
    date: currDate,
    lineItems: lineItems }; 

const creditNotes: CreditNotes = {  
    creditNotes: [creditNote] }; 

try {
  const response = await xero.accountingApi.updateCreditNote(xeroTenantId, creditNoteID, creditNotes,  unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateCreditNoteExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var creditNoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var unitdp = 4;
            var currDate = DateTime.Now;

            var contact = new Contact();
            contact.ContactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var lineItem = new LineItem();
            lineItem.Description = "Foobar";
            lineItem.Quantity = new decimal(1.0);
            lineItem.UnitAmount = new decimal(20.0);
            lineItem.AccountCode = "000";
            var lineItems = new List<LineItem>();
            lineItems.Add(lineItem);

            var creditNote = new CreditNote();
            creditNote.Type = CreditNote.TypeEnum.ACCPAYCREDIT;
            creditNote.Status = CreditNote.StatusEnum.AUTHORISED;
            creditNote.Reference = "My ref.";
            creditNote.Contact = contact;
            creditNote.Date = currDate;
            creditNote.LineItems = lineItems;

            var creditNotes = new CreditNotes();
            var creditNotesList = new List<CreditNote>();
            creditNotesList.Add(creditNote); 
            creditNotes._CreditNotes = creditNotesList;
            
            try {
                var result = await apiInstance.UpdateCreditNoteAsync(accessToken, xeroTenantId, creditNoteID, creditNotes, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateCreditNote: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$creditNoteID = "00000000-0000-0000-0000-000000000000";
$unitdp = 4;
$currDate = new DateTime('2020-12-10');

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItems = [];
array_push($lineItems, $lineItem);

$creditNote = new XeroAPI\XeroPHP\Models\Accounting\CreditNote;
$creditNote->setType(XeroAPI\XeroPHP\Models\Accounting\CreditNote::TYPE_ACCPAYCREDIT);
$creditNote->setStatus(XeroAPI\XeroPHP\Models\Accounting\CreditNote::STATUS_AUTHORISED);
$creditNote->setReference('My ref.');
$creditNote->setContact($contact);
$creditNote->setDate($currDate);
$creditNote->setLineItems($lineItems);

$creditNotes = new XeroAPI\XeroPHP\Models\Accounting\CreditNotes;
$arr_credit_notes = [];
array_push($arr_credit_notes, $creditNote);
$creditNotes->setCreditNotes($arr_credit_notes);

try {
  $result = $apiInstance->updateCreditNote($xeroTenantId, $creditNoteID, $creditNotes, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateCreditNote: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Credit Note
my $creditNotes = ::Object::CreditNotes->new(); # CreditNotes | 
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->updateCreditNote(xeroTenantId => $xeroTenantId, creditNoteID => $creditNoteID, creditNotes => $creditNotes, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateCreditNote: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_credit_note():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    credit_note_id = '00000000-0000-0000-0000-000000000000'
    curr_date = dateutil.parser.parse('2020-12-03T00:00:00Z')

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000")
    
    line_items = []    
    line_items.append(line_item)

    credit_note = CreditNote(
        type = "ACCPAYCREDIT",
        status = "AUTHORISED",
        reference = "My ref.",
        contact = contact,
        date = curr_date,
        line_items = line_items)

    creditNotes = CreditNotes( 
        credit_notes = [credit_note])
    
    try:
        api_response = api_instance.update_credit_note(xero_tenant_id, credit_note_id, creditNotes, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateCreditNote: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let creditNotes = { "CreditNotes": [ { "Type": "ACCPAYCREDIT", "Contact": { "ContactID": "430fa14a-f945-44d3-9f97-5df5e28441b8" }, "Date": "2019-01-05", "Status": "AUTHORISED", "Reference": "HelloWorld", "LineItems": [ { "Description": "Foobar", "Quantity": 2, "UnitAmount": 20, "AccountCode": "400" } ] } ] }; // CreditNotes
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.updateCreditNote(xeroTenantId, creditNoteID, creditNotes, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
CreditNoteID*
UUID (uuid)
Unique identifier for a Credit Note
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
creditNotes *
CreditNotes
an array of Credit Notes containing credit note details to update
Required
Query parameters
Name Description
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

updateCreditNoteAttachmentByFileName

Updates attachments on a specific credit note by file name


/CreditNotes/{CreditNoteID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes/{CreditNoteID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID creditNoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.updateCreditNoteAttachmentByFileName(accessToken, xeroTenantId, creditNoteID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateCreditNoteAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Credit Note
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.updateCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateCreditNoteAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *creditNoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Credit Note (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates attachments on a specific credit note by file name
[apiInstance updateCreditNoteAttachmentByFileNameWith:xeroTenantId
    creditNoteID:creditNoteID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const creditNoteID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.updateCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateCreditNoteAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var creditNoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.UpdateCreditNoteAttachmentByFileNameAsync(accessToken, xeroTenantId, creditNoteID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateCreditNoteAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$creditNoteID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->updateCreditNoteAttachmentByFileName($xeroTenantId, $creditNoteID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateCreditNoteAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Credit Note
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->updateCreditNoteAttachmentByFileName(xeroTenantId => $xeroTenantId, creditNoteID => $creditNoteID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateCreditNoteAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_credit_note_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    credit_note_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.update_credit_note_attachment_by_file_name(xero_tenant_id, credit_note_id, file_name, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateCreditNoteAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.updateCreditNoteAttachmentByFileName(xeroTenantId, creditNoteID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
CreditNoteID*
UUID (uuid)
Unique identifier for a Credit Note
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

updateExpenseClaim

Updates a specific expense claims


/ExpenseClaims/{ExpenseClaimID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ExpenseClaims/{ExpenseClaimID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID expenseClaimID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        LocalDate currDate = LocalDate.now();
        
        User user = new User();
        user.setUserID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        Receipt receipt = new Receipt();
        receipt.setReceiptID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        receipt.setDate(currDate);

        List<Receipt> receipts = new ArrayList<Receipt>();
        receipts.add(receipt);
        
        ExpenseClaim expenseClaim = new ExpenseClaim();
        expenseClaim.setStatus(com.xero.models.accounting.ExpenseClaim.StatusEnum.SUBMITTED);
        expenseClaim.setUser(user);
        expenseClaim.setReceipts(receipts);
        
        ExpenseClaims expenseClaims = new ExpenseClaims();
        expenseClaims.addExpenseClaimsItem(expenseClaim);

        try {
            ExpenseClaims result = apiInstance.updateExpenseClaim(accessToken, xeroTenantId, expenseClaimID, expenseClaims);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateExpenseClaim");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID expenseClaimID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a ExpenseClaim
        ExpenseClaims expenseClaims = { "ExpenseClaims": [ { "Status": "SUBMITTED", "User": { "UserID": "d1164823-0ac1-41ad-987b-b4e30fe0b273" }, "Receipts": [ { "Lineitems": [], "ReceiptID": "dc1c7f6d-0a4c-402f-acac-551d62ce5816" } ] } ] }; // ExpenseClaims | 
        try {
            ExpenseClaims result = apiInstance.updateExpenseClaim(xeroTenantId, expenseClaimID, expenseClaims);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateExpenseClaim");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *expenseClaimID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a ExpenseClaim (default to null)
ExpenseClaims *expenseClaims = { "ExpenseClaims": [ { "Status": "SUBMITTED", "User": { "UserID": "d1164823-0ac1-41ad-987b-b4e30fe0b273" }, "Receipts": [ { "Lineitems": [], "ReceiptID": "dc1c7f6d-0a4c-402f-acac-551d62ce5816" } ] } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific expense claims
[apiInstance updateExpenseClaimWith:xeroTenantId
    expenseClaimID:expenseClaimID
    expenseClaims:expenseClaims
              completionHandler: ^(ExpenseClaims output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const expenseClaimID = '00000000-0000-0000-0000-000000000000';
const currDate = '2020-12-10'

const user: User = { 
    userID: "00000000-0000-0000-0000-000000000000" }; 

const receipt: Receipt = { 
    receiptID: "00000000-0000-0000-0000-000000000000",
    date: currDate };   
const receipts = [];    
receipts.push(receipt)

const expenseClaim: ExpenseClaim = { 
    status: ExpenseClaim.StatusEnum.SUBMITTED,
    user: user,
    receipts: receipts }; 

const expenseClaims: ExpenseClaims = {  
    expenseClaims: [expenseClaim] }; 

try {
  const response = await xero.accountingApi.updateExpenseClaim(xeroTenantId, expenseClaimID, expenseClaims);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateExpenseClaimExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var expenseClaimID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var currDate = DateTime.Now;

            var user = new User();
            user.UserID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var receipt = new Receipt();
            receipt.ReceiptID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            receipt.Date = currDate;
            var receipts = new List<Receipt>();
            receipts.Add(receipt);

            var expenseClaim = new ExpenseClaim();
            expenseClaim.Status = ExpenseClaim.StatusEnum.SUBMITTED;
            expenseClaim.User = user;
            expenseClaim.Receipts = receipts;

            var expenseClaims = new ExpenseClaims();
            var expenseClaimsList = new List<ExpenseClaim>();
            expenseClaimsList.Add(expenseClaim); 
            expenseClaims._ExpenseClaims = expenseClaimsList;
            
            try {
                var result = await apiInstance.UpdateExpenseClaimAsync(accessToken, xeroTenantId, expenseClaimID, expenseClaims);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateExpenseClaim: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$expenseClaimID = "00000000-0000-0000-0000-000000000000";
$currDate = new DateTime('2020-12-10');

$user = new XeroAPI\XeroPHP\Models\Accounting\User;
$user->setUserID('00000000-0000-0000-0000-000000000000');

$receipt = new XeroAPI\XeroPHP\Models\Accounting\Receipt;
$receipt->setReceiptID('00000000-0000-0000-0000-000000000000');
$receipt->setDate($currDate);
$receipts = [];
array_push($receipts, $receipt);

$expenseClaim = new XeroAPI\XeroPHP\Models\Accounting\ExpenseClaim;
$expenseClaim->setStatus(XeroAPI\XeroPHP\Models\Accounting\ExpenseClaim::STATUS_SUBMITTED);
$expenseClaim->setUser($user);
$expenseClaim->setReceipts($receipts);

$expenseClaims = new XeroAPI\XeroPHP\Models\Accounting\ExpenseClaims;
$arr_expense_claims = [];
array_push($arr_expense_claims, $expenseClaim);
$expenseClaims->setExpenseClaims($arr_expense_claims);

try {
  $result = $apiInstance->updateExpenseClaim($xeroTenantId, $expenseClaimID, $expenseClaims);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateExpenseClaim: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $expenseClaimID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a ExpenseClaim
my $expenseClaims = ::Object::ExpenseClaims->new(); # ExpenseClaims | 

eval { 
    my $result = $api_instance->updateExpenseClaim(xeroTenantId => $xeroTenantId, expenseClaimID => $expenseClaimID, expenseClaims => $expenseClaims);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateExpenseClaim: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_expense_claim():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    expense_claim_id = '00000000-0000-0000-0000-000000000000'
    curr_date = dateutil.parser.parse('2020-12-03T00:00:00Z')

    user = User(
        user_id = "00000000-0000-0000-0000-000000000000")

    receipt = Receipt(
        receipt_id = "00000000-0000-0000-0000-000000000000",
        date = curr_date)
    
    receipts = []    
    receipts.append(receipt)

    expense_claim = ExpenseClaim(
        status = "SUBMITTED",
        user = user,
        receipts = receipts)

    expenseClaims = ExpenseClaims( 
        expense_claims = [expense_claim])
    
    try:
        api_response = api_instance.update_expense_claim(xero_tenant_id, expense_claim_id, expenseClaims)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateExpenseClaim: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let expenseClaimID = 00000000-0000-0000-0000-000000000000; // UUID
    let expenseClaims = { "ExpenseClaims": [ { "Status": "SUBMITTED", "User": { "UserID": "d1164823-0ac1-41ad-987b-b4e30fe0b273" }, "Receipts": [ { "Lineitems": [], "ReceiptID": "dc1c7f6d-0a4c-402f-acac-551d62ce5816" } ] } ] }; // ExpenseClaims

    let mut context = AccountingApi::Context::default();
    let result = client.updateExpenseClaim(xeroTenantId, expenseClaimID, expenseClaims, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
ExpenseClaimID*
UUID (uuid)
Unique identifier for a ExpenseClaim
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
expenseClaims *
ExpenseClaims
Required

updateInvoice

Updates a specific sales invoices or purchase bills


/Invoices/{InvoiceID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}?unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID invoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Integer unitdp = 4;
        
        Invoice invoice = new Invoice();
        invoice.setReference("I am Iron man");
        
        Invoices invoices = new Invoices();
        invoices.addInvoicesItem(invoice);

        try {
            Invoices result = apiInstance.updateInvoice(accessToken, xeroTenantId, invoiceID, invoices, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateInvoice");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID invoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Invoice
        Invoices invoices = { "Invoices": [{ Reference: "May the force be with you", "InvoiceID": "00000000-0000-0000-0000-000000000000", "LineItems": [], "Contact": {}, "Type": "ACCPAY" }]}; // Invoices | 
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Invoices result = apiInstance.updateInvoice(xeroTenantId, invoiceID, invoices, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateInvoice");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *invoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Invoice (default to null)
Invoices *invoices = { "Invoices": [{ Reference: "May the force be with you", "InvoiceID": "00000000-0000-0000-0000-000000000000", "LineItems": [], "Contact": {}, "Type": "ACCPAY" }]}; // 
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific sales invoices or purchase bills
[apiInstance updateInvoiceWith:xeroTenantId
    invoiceID:invoiceID
    invoices:invoices
    unitdp:unitdp
              completionHandler: ^(Invoices output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const invoiceID = '00000000-0000-0000-0000-000000000000';
const unitdp = 4;

const invoice: Invoice = { 
    reference: "I am Iron man" }; 

const invoices: Invoices = {  
    invoices: [invoice] }; 

try {
  const response = await xero.accountingApi.updateInvoice(xeroTenantId, invoiceID, invoices,  unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateInvoiceExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var invoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var unitdp = 4;

            var invoice = new Invoice();
            invoice.Reference = "I am Iron man";

            var invoices = new Invoices();
            var invoicesList = new List<Invoice>();
            invoicesList.Add(invoice); 
            invoices._Invoices = invoicesList;
            
            try {
                var result = await apiInstance.UpdateInvoiceAsync(accessToken, xeroTenantId, invoiceID, invoices, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateInvoice: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$invoiceID = "00000000-0000-0000-0000-000000000000";
$unitdp = 4;

$invoice = new XeroAPI\XeroPHP\Models\Accounting\Invoice;
$invoice->setReference('I am Iron man');

$invoices = new XeroAPI\XeroPHP\Models\Accounting\Invoices;
$arr_invoices = [];
array_push($arr_invoices, $invoice);
$invoices->setInvoices($arr_invoices);

try {
  $result = $apiInstance->updateInvoice($xeroTenantId, $invoiceID, $invoices, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateInvoice: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Invoice
my $invoices = ::Object::Invoices->new(); # Invoices | 
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->updateInvoice(xeroTenantId => $xeroTenantId, invoiceID => $invoiceID, invoices => $invoices, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateInvoice: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_invoice():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    invoice_id = '00000000-0000-0000-0000-000000000000'

    invoice = Invoice(
        reference = "I am Iron man")

    invoices = Invoices( 
        invoices = [invoice])
    
    try:
        api_response = api_instance.update_invoice(xero_tenant_id, invoice_id, invoices, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateInvoice: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let invoices = { "Invoices": [{ Reference: "May the force be with you", "InvoiceID": "00000000-0000-0000-0000-000000000000", "LineItems": [], "Contact": {}, "Type": "ACCPAY" }]}; // Invoices
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.updateInvoice(xeroTenantId, invoiceID, invoices, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
InvoiceID*
UUID (uuid)
Unique identifier for an Invoice
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
invoices *
Invoices
Required
Query parameters
Name Description
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

updateInvoiceAttachmentByFileName

Updates an attachment from a specific invoices or purchase bill by filename


/Invoices/{InvoiceID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices/{InvoiceID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID invoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.updateInvoiceAttachmentByFileName(accessToken, xeroTenantId, invoiceID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateInvoiceAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID invoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Invoice
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.updateInvoiceAttachmentByFileName(xeroTenantId, invoiceID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateInvoiceAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *invoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Invoice (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates an attachment from a specific invoices or purchase bill by filename
[apiInstance updateInvoiceAttachmentByFileNameWith:xeroTenantId
    invoiceID:invoiceID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const invoiceID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.updateInvoiceAttachmentByFileName(xeroTenantId, invoiceID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateInvoiceAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var invoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.UpdateInvoiceAttachmentByFileNameAsync(accessToken, xeroTenantId, invoiceID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateInvoiceAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$invoiceID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->updateInvoiceAttachmentByFileName($xeroTenantId, $invoiceID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateInvoiceAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Invoice
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->updateInvoiceAttachmentByFileName(xeroTenantId => $xeroTenantId, invoiceID => $invoiceID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateInvoiceAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_invoice_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    invoice_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.update_invoice_attachment_by_file_name(xero_tenant_id, invoice_id, file_name, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateInvoiceAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.updateInvoiceAttachmentByFileName(xeroTenantId, invoiceID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
InvoiceID*
UUID (uuid)
Unique identifier for an Invoice
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

updateItem

Updates a specific item


/Items/{ItemID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Items/{ItemID}?unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID itemID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Integer unitdp = 4;
        
        Item item = new Item();
        item.setCode("ItemCode123");
        item.setDescription("Goodbye");
        
        Items items = new Items();
        items.addItemsItem(item);

        try {
            Items result = apiInstance.updateItem(accessToken, xeroTenantId, itemID, items, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateItem");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID itemID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Item
        Items items = { "Items": [ { "Code": "ItemCode123", "Description": "Description 123" } ] }; // Items | 
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Items result = apiInstance.updateItem(xeroTenantId, itemID, items, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateItem");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *itemID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Item (default to null)
Items *items = { "Items": [ { "Code": "ItemCode123", "Description": "Description 123" } ] }; // 
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific item
[apiInstance updateItemWith:xeroTenantId
    itemID:itemID
    items:items
    unitdp:unitdp
              completionHandler: ^(Items output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const itemID = '00000000-0000-0000-0000-000000000000';
const unitdp = 4;

const item: Item = { 
    code: "ItemCode123",
    description: "Goodbye" }; 

const items: Items = {  
    items: [item] }; 

try {
  const response = await xero.accountingApi.updateItem(xeroTenantId, itemID, items,  unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateItemExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var itemID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var unitdp = 4;

            var item = new Item();
            item.Code = "ItemCode123";
            item.Description = "Goodbye";

            var items = new Items();
            var itemsList = new List<Item>();
            itemsList.Add(item); 
            items._Items = itemsList;
            
            try {
                var result = await apiInstance.UpdateItemAsync(accessToken, xeroTenantId, itemID, items, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateItem: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$itemID = "00000000-0000-0000-0000-000000000000";
$unitdp = 4;

$item = new XeroAPI\XeroPHP\Models\Accounting\Item;
$item->setCode('ItemCode123');
$item->setDescription('Goodbye');

$items = new XeroAPI\XeroPHP\Models\Accounting\Items;
$arr_items = [];
array_push($arr_items, $item);
$items->setItems($arr_items);

try {
  $result = $apiInstance->updateItem($xeroTenantId, $itemID, $items, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateItem: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $itemID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Item
my $items = ::Object::Items->new(); # Items | 
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->updateItem(xeroTenantId => $xeroTenantId, itemID => $itemID, items => $items, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateItem: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_item():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    item_id = '00000000-0000-0000-0000-000000000000'

    item = Item(
        code = "ItemCode123",
        description = "Goodbye")

    items = Items( 
        items = [item])
    
    try:
        api_response = api_instance.update_item(xero_tenant_id, item_id, items, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateItem: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let itemID = 00000000-0000-0000-0000-000000000000; // UUID
    let items = { "Items": [ { "Code": "ItemCode123", "Description": "Description 123" } ] }; // Items
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.updateItem(xeroTenantId, itemID, items, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Path parameters
Name Description
ItemID*
UUID (uuid)
Unique identifier for an Item
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
items *
Items
Required
Query parameters
Name Description
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

updateLinkedTransaction

Updates a specific linked transactions (billable expenses)


/LinkedTransactions/{LinkedTransactionID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/LinkedTransactions/{LinkedTransactionID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID linkedTransactionID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        LinkedTransaction linkedTransaction = new LinkedTransaction();
        linkedTransaction.setSourceLineItemID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        linkedTransaction.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        LinkedTransactions linkedTransactions = new LinkedTransactions();
        linkedTransactions.addLinkedTransactionsItem(linkedTransaction);

        try {
            LinkedTransactions result = apiInstance.updateLinkedTransaction(accessToken, xeroTenantId, linkedTransactionID, linkedTransactions);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateLinkedTransaction");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID linkedTransactionID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a LinkedTransaction
        LinkedTransactions linkedTransactions = { "LinkedTransactions": [ { "SourceTransactionID": "00000000-0000-0000-0000-000000000000", "SourceLineItemID": "00000000-0000-0000-0000-000000000000" } ] }; // LinkedTransactions | 
        try {
            LinkedTransactions result = apiInstance.updateLinkedTransaction(xeroTenantId, linkedTransactionID, linkedTransactions);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateLinkedTransaction");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *linkedTransactionID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a LinkedTransaction (default to null)
LinkedTransactions *linkedTransactions = { "LinkedTransactions": [ { "SourceTransactionID": "00000000-0000-0000-0000-000000000000", "SourceLineItemID": "00000000-0000-0000-0000-000000000000" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific linked transactions (billable expenses)
[apiInstance updateLinkedTransactionWith:xeroTenantId
    linkedTransactionID:linkedTransactionID
    linkedTransactions:linkedTransactions
              completionHandler: ^(LinkedTransactions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const linkedTransactionID = '00000000-0000-0000-0000-000000000000';

const linkedTransaction: LinkedTransaction = { 
    sourceLineItemID: "00000000-0000-0000-0000-000000000000",
    contactID: "00000000-0000-0000-0000-000000000000" }; 

const linkedTransactions: LinkedTransactions = {  
    linkedTransactions: [linkedTransaction] }; 

try {
  const response = await xero.accountingApi.updateLinkedTransaction(xeroTenantId, linkedTransactionID, linkedTransactions);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateLinkedTransactionExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var linkedTransactionID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var linkedTransaction = new LinkedTransaction();
            linkedTransaction.SourceLineItemID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            linkedTransaction.ContactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var linkedTransactions = new LinkedTransactions();
            var linkedTransactionsList = new List<LinkedTransaction>();
            linkedTransactionsList.Add(linkedTransaction); 
            linkedTransactions._LinkedTransactions = linkedTransactionsList;
            
            try {
                var result = await apiInstance.UpdateLinkedTransactionAsync(accessToken, xeroTenantId, linkedTransactionID, linkedTransactions);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateLinkedTransaction: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$linkedTransactionID = "00000000-0000-0000-0000-000000000000";

$linkedTransaction = new XeroAPI\XeroPHP\Models\Accounting\LinkedTransaction;
$linkedTransaction->setSourceLineItemID('00000000-0000-0000-0000-000000000000');
$linkedTransaction->setContactID('00000000-0000-0000-0000-000000000000');

$linkedTransactions = new XeroAPI\XeroPHP\Models\Accounting\LinkedTransactions;
$arr_linked_transactions = [];
array_push($arr_linked_transactions, $linkedTransaction);
$linkedTransactions->setLinkedTransactions($arr_linked_transactions);

try {
  $result = $apiInstance->updateLinkedTransaction($xeroTenantId, $linkedTransactionID, $linkedTransactions);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateLinkedTransaction: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $linkedTransactionID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a LinkedTransaction
my $linkedTransactions = ::Object::LinkedTransactions->new(); # LinkedTransactions | 

eval { 
    my $result = $api_instance->updateLinkedTransaction(xeroTenantId => $xeroTenantId, linkedTransactionID => $linkedTransactionID, linkedTransactions => $linkedTransactions);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateLinkedTransaction: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_linked_transaction():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    linked_transaction_id = '00000000-0000-0000-0000-000000000000'

    linked_transaction = LinkedTransaction(
        source_line_item_id = "00000000-0000-0000-0000-000000000000",
        contactID = "00000000-0000-0000-0000-000000000000")

    linkedTransactions = LinkedTransactions( 
        linked_transactions = [linked_transaction])
    
    try:
        api_response = api_instance.update_linked_transaction(xero_tenant_id, linked_transaction_id, linkedTransactions)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateLinkedTransaction: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let linkedTransactionID = 00000000-0000-0000-0000-000000000000; // UUID
    let linkedTransactions = { "LinkedTransactions": [ { "SourceTransactionID": "00000000-0000-0000-0000-000000000000", "SourceLineItemID": "00000000-0000-0000-0000-000000000000" } ] }; // LinkedTransactions

    let mut context = AccountingApi::Context::default();
    let result = client.updateLinkedTransaction(xeroTenantId, linkedTransactionID, linkedTransactions, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
LinkedTransactionID*
UUID (uuid)
Unique identifier for a LinkedTransaction
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
linkedTransactions *
LinkedTransactions
Required

updateManualJournal

Updates a specific manual journal


/ManualJournals/{ManualJournalID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ManualJournals/{ManualJournalID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID manualJournalID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);

        List<ManualJournalLine> manualJournalLines = new ArrayList<ManualJournalLine>();
        
        ManualJournalLine credit = new ManualJournalLine();
        credit.setLineAmount(100.0);
        credit.setAccountCode("400");
        credit.setDescription("Hello there");
        manualJournalLines.add(credit);
        
        ManualJournalLine debit = new ManualJournalLine();
        debit.setLineAmount(-100.0);
        debit.setAccountCode("120");
        debit.setDescription("Hello there");
        manualJournalLines.add(debit);
        
        ManualJournal manualJournal = new ManualJournal();
        manualJournal.setNarration("Foobar");
        manualJournal.setDate(dateValue);
        manualJournal.setJournalLines(manualJournalLines);
        
        ManualJournals manualJournals = new ManualJournals();
        manualJournals.addManualJournalsItem(manualJournal);

        try {
            ManualJournals result = apiInstance.updateManualJournal(accessToken, xeroTenantId, manualJournalID, manualJournals);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateManualJournal");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a ManualJournal
        ManualJournals manualJournals = { "ManualJournals": [ { "Narration": "Hello Xero", "ManualJournalID": "00000000-0000-0000-0000-000000000000", "JournalLines": [] } ] }; // ManualJournals | 
        try {
            ManualJournals result = apiInstance.updateManualJournal(xeroTenantId, manualJournalID, manualJournals);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateManualJournal");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *manualJournalID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a ManualJournal (default to null)
ManualJournals *manualJournals = { "ManualJournals": [ { "Narration": "Hello Xero", "ManualJournalID": "00000000-0000-0000-0000-000000000000", "JournalLines": [] } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific manual journal
[apiInstance updateManualJournalWith:xeroTenantId
    manualJournalID:manualJournalID
    manualJournals:manualJournals
              completionHandler: ^(ManualJournals output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const manualJournalID = '00000000-0000-0000-0000-000000000000';
const dateValue = '2020-10-10'  
const manualJournalLines = [];

const credit: ManualJournalLine = { 
    lineAmount: 100.0,
    accountCode: "400",
    description: "Hello there" };     
manualJournalLines.push(credit)

const debit: ManualJournalLine = { 
    lineAmount: -100.0,
    accountCode: "120",
    description: "Hello there" };     
manualJournalLines.push(debit)

const manualJournal: ManualJournal = { 
    narration: "Foobar",
    date: dateValue,
    manualJournalLines: manualJournalLines }; 

const manualJournals: ManualJournals = {  
    manualJournals: [manualJournal] }; 

try {
  const response = await xero.accountingApi.updateManualJournal(xeroTenantId, manualJournalID, manualJournals);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateManualJournalExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var manualJournalID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var dateValue = new DateTime(2020, 10, 10);
            var manualJournalLines = new List<ManualJournalLine>();

            var credit = new ManualJournalLine();
            credit.LineAmount = new decimal(100.0);
            credit.AccountCode = "400";
            credit.Description = "Hello there";
            manualJournalLines.Add(credit);

            var debit = new ManualJournalLine();
            debit.LineAmount = new decimal(-100.0);
            debit.AccountCode = "120";
            debit.Description = "Hello there";
            manualJournalLines.Add(debit);

            var manualJournal = new ManualJournal();
            manualJournal.Narration = "Foobar";
            manualJournal.Date = dateValue;
            manualJournal.JournalLines = manualJournalLines;

            var manualJournals = new ManualJournals();
            var manualJournalsList = new List<ManualJournal>();
            manualJournalsList.Add(manualJournal); 
            manualJournals._ManualJournals = manualJournalsList;
            
            try {
                var result = await apiInstance.UpdateManualJournalAsync(accessToken, xeroTenantId, manualJournalID, manualJournals);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateManualJournal: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$manualJournalID = "00000000-0000-0000-0000-000000000000";
$dateValue = new DateTime('2020-10-10');
$manualJournalLines = [];

$credit = new XeroAPI\XeroPHP\Models\Accounting\ManualJournalLine;
$credit->setLineAmount(100.0);
$credit->setAccountCode('400');
$credit->setDescription('Hello there');
array_push($manualJournalLines, $credit);

$debit = new XeroAPI\XeroPHP\Models\Accounting\ManualJournalLine;
$debit->setLineAmount(-100.0);
$debit->setAccountCode('120');
$debit->setDescription('Hello there');
array_push($manualJournalLines, $debit);

$manualJournal = new XeroAPI\XeroPHP\Models\Accounting\ManualJournal;
$manualJournal->setNarration('Foobar');
$manualJournal->setDate($dateValue);
$manualJournal->setJournalLines($manualJournalLines);

$manualJournals = new XeroAPI\XeroPHP\Models\Accounting\ManualJournals;
$arr_manual_journals = [];
array_push($arr_manual_journals, $manualJournal);
$manualJournals->setManualJournals($arr_manual_journals);

try {
  $result = $apiInstance->updateManualJournal($xeroTenantId, $manualJournalID, $manualJournals);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateManualJournal: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $manualJournalID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a ManualJournal
my $manualJournals = ::Object::ManualJournals->new(); # ManualJournals | 

eval { 
    my $result = $api_instance->updateManualJournal(xeroTenantId => $xeroTenantId, manualJournalID => $manualJournalID, manualJournals => $manualJournals);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateManualJournal: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_manual_journal():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    manual_journal_id = '00000000-0000-0000-0000-000000000000'
    date_value = dateutil.parser.parse('2020-12-03T00:00:00Z')
    
    manual_journal_lines = []

    credit = ManualJournalLine(
        line_amount = 100.0,
        account_code = "400",
        description = "Hello there")    
    manual_journal_lines.append(credit)

    debit = ManualJournalLine(
        line_amount = -100.0,
        account_code = "120",
        description = "Hello there")    
    manual_journal_lines.append(debit)

    manual_journal = ManualJournal(
        narration = "Foobar",
        date = date_value,
        journal_lines = manual_journal_lines)

    manualJournals = ManualJournals( 
        manual_journals = [manual_journal])
    
    try:
        api_response = api_instance.update_manual_journal(xero_tenant_id, manual_journal_id, manualJournals)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateManualJournal: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID
    let manualJournals = { "ManualJournals": [ { "Narration": "Hello Xero", "ManualJournalID": "00000000-0000-0000-0000-000000000000", "JournalLines": [] } ] }; // ManualJournals

    let mut context = AccountingApi::Context::default();
    let result = client.updateManualJournal(xeroTenantId, manualJournalID, manualJournals, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
ManualJournalID*
UUID (uuid)
Unique identifier for a ManualJournal
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
manualJournals *
ManualJournals
Required

updateManualJournalAttachmentByFileName

Updates a specific attachment from a specific manual journal by file name


/ManualJournals/{ManualJournalID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ManualJournals/{ManualJournalID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID manualJournalID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.updateManualJournalAttachmentByFileName(accessToken, xeroTenantId, manualJournalID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateManualJournalAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a ManualJournal
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.updateManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateManualJournalAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *manualJournalID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a ManualJournal (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific attachment from a specific manual journal by file name
[apiInstance updateManualJournalAttachmentByFileNameWith:xeroTenantId
    manualJournalID:manualJournalID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const manualJournalID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.updateManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateManualJournalAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var manualJournalID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.UpdateManualJournalAttachmentByFileNameAsync(accessToken, xeroTenantId, manualJournalID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateManualJournalAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$manualJournalID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->updateManualJournalAttachmentByFileName($xeroTenantId, $manualJournalID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateManualJournalAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $manualJournalID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a ManualJournal
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->updateManualJournalAttachmentByFileName(xeroTenantId => $xeroTenantId, manualJournalID => $manualJournalID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateManualJournalAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_manual_journal_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    manual_journal_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.update_manual_journal_attachment_by_file_name(xero_tenant_id, manual_journal_id, file_name, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateManualJournalAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let manualJournalID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.updateManualJournalAttachmentByFileName(xeroTenantId, manualJournalID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
ManualJournalID*
UUID (uuid)
Unique identifier for a ManualJournal
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

updateOrCreateBankTransactions

Updates or creates one or more spent or received money transaction


/BankTransactions

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/BankTransactions?summarizeErrors=true&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        Boolean summarizeErrors = true;
        Integer unitdp = 4;
        
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");

        List<LineItem> lineItems = new ArrayList<LineItem>();
        lineItems.add(lineItem);
        
        Account bankAccount = new Account();
        bankAccount.setAccountID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        BankTransaction bankTransaction = new BankTransaction();
        bankTransaction.setType(com.xero.models.accounting.BankTransaction.TypeEnum.RECEIVE);
        bankTransaction.setContact(contact);
        bankTransaction.setLineItems(lineItems);
        bankTransaction.setBankAccount(bankAccount);
        
        BankTransactions bankTransactions = new BankTransactions();
        bankTransactions.addBankTransactionsItem(bankTransaction);

        try {
            BankTransactions result = apiInstance.updateOrCreateBankTransactions(accessToken, xeroTenantId, bankTransactions, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateBankTransactions");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        BankTransactions bankTransactions = { "BankTransactions": [ { "Type": "SPEND", "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "Lineitems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "400" } ], "BankAccount": { "Code": "088" } } ] }; // BankTransactions | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            BankTransactions result = apiInstance.updateOrCreateBankTransactions(xeroTenantId, bankTransactions, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateBankTransactions");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
BankTransactions *bankTransactions = { "BankTransactions": [ { "Type": "SPEND", "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "Lineitems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "400" } ], "BankAccount": { "Code": "088" } } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates or creates one or more spent or received money transaction
[apiInstance updateOrCreateBankTransactionsWith:xeroTenantId
    bankTransactions:bankTransactions
    summarizeErrors:summarizeErrors
    unitdp:unitdp
              completionHandler: ^(BankTransactions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;
const unitdp = 4;

const contact: Contact = { 
    contactID: "00000000-0000-0000-0000-000000000000" }; 

const lineItem: LineItem = { 
    description: "Foobar",
    quantity: 1.0,
    unitAmount: 20.0,
    accountCode: "000" };   
const lineItems = [];    
lineItems.push(lineItem)

const bankAccount: Account = { 
    accountID: "00000000-0000-0000-0000-000000000000" }; 

const bankTransaction: BankTransaction = { 
    type: BankTransaction.TypeEnum.RECEIVE,
    contact: contact,
    lineItems: lineItems,
    bankAccount: bankAccount }; 

const bankTransactions: BankTransactions = {  
    bankTransactions: [bankTransaction] }; 

try {
  const response = await xero.accountingApi.updateOrCreateBankTransactions(xeroTenantId, bankTransactions,  summarizeErrors, unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateOrCreateBankTransactionsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;
            var unitdp = 4;

            var contact = new Contact();
            contact.ContactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var lineItem = new LineItem();
            lineItem.Description = "Foobar";
            lineItem.Quantity = new decimal(1.0);
            lineItem.UnitAmount = new decimal(20.0);
            lineItem.AccountCode = "000";
            var lineItems = new List<LineItem>();
            lineItems.Add(lineItem);

            var bankAccount = new Account();
            bankAccount.AccountID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var bankTransaction = new BankTransaction();
            bankTransaction.Type = BankTransaction.TypeEnum.RECEIVE;
            bankTransaction.Contact = contact;
            bankTransaction.LineItems = lineItems;
            bankTransaction.BankAccount = bankAccount;

            var bankTransactions = new BankTransactions();
            var bankTransactionsList = new List<BankTransaction>();
            bankTransactionsList.Add(bankTransaction); 
            bankTransactions._BankTransactions = bankTransactionsList;
            
            try {
                var result = await apiInstance.UpdateOrCreateBankTransactionsAsync(accessToken, xeroTenantId, bankTransactions, summarizeErrors, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateOrCreateBankTransactions: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$unitdp = 4;

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItems = [];
array_push($lineItems, $lineItem);

$bankAccount = new XeroAPI\XeroPHP\Models\Accounting\Account;
$bankAccount->setAccountID('00000000-0000-0000-0000-000000000000');

$bankTransaction = new XeroAPI\XeroPHP\Models\Accounting\BankTransaction;
$bankTransaction->setType(XeroAPI\XeroPHP\Models\Accounting\BankTransaction::TYPE_RECEIVE);
$bankTransaction->setContact($contact);
$bankTransaction->setLineItems($lineItems);
$bankTransaction->setBankAccount($bankAccount);

$bankTransactions = new XeroAPI\XeroPHP\Models\Accounting\BankTransactions;
$arr_bank_transactions = [];
array_push($arr_bank_transactions, $bankTransaction);
$bankTransactions->setBankTransactions($arr_bank_transactions);

try {
  $result = $apiInstance->updateOrCreateBankTransactions($xeroTenantId, $bankTransactions, $summarizeErrors, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateOrCreateBankTransactions: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $bankTransactions = ::Object::BankTransactions->new(); # BankTransactions | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->updateOrCreateBankTransactions(xeroTenantId => $xeroTenantId, bankTransactions => $bankTransactions, summarizeErrors => $summarizeErrors, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateOrCreateBankTransactions: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_or_create_bank_transactions():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000")
    
    line_items = []    
    line_items.append(line_item)

    bank_account = Account(
        account_id = "00000000-0000-0000-0000-000000000000")

    bank_transaction = BankTransaction(
        type = "RECEIVE",
        contact = contact,
        lineItems = lineItems,
        bank_account = bank_account)

    bankTransactions = BankTransactions( 
        bank_transactions = [bank_transaction])
    
    try:
        api_response = api_instance.update_or_create_bank_transactions(xero_tenant_id, bankTransactions, summarize_errors, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateOrCreateBankTransactions: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let bankTransactions = { "BankTransactions": [ { "Type": "SPEND", "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "Lineitems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "400" } ], "BankAccount": { "Code": "088" } } ] }; // BankTransactions
    let summarizeErrors = true; // Boolean
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.updateOrCreateBankTransactions(xeroTenantId, bankTransactions, summarizeErrors, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
bankTransactions *
BankTransactions
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

updateOrCreateContacts

Updates or creates one or more contacts in a Xero organisation


/Contacts

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Contacts?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        Boolean summarizeErrors = true;
        
        Phone phone = new Phone();
        phone.setPhoneNumber("555-1212");
        phone.setPhoneType(com.xero.models.accounting.Phone.PhoneTypeEnum.MOBILE);

        List<Phone> phones = new ArrayList<Phone>();
        phones.add(phone);
        
        Contact contact = new Contact();
        contact.setName("Bruce Banner");
        contact.setEmailAddress("hulk@avengers.com");
        contact.setPhones(phones);
        
        Contacts contacts = new Contacts();
        contacts.addContactsItem(contact);

        try {
            Contacts result = apiInstance.updateOrCreateContacts(accessToken, xeroTenantId, contacts, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateContacts");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Contacts contacts = { "Contacts": [ { "Name": "Bruce Banner", "EmailAddress": "hulk@avengers.com", "Phones": [ { "PhoneType": "MOBILE", "PhoneNumber": "555-1212", "PhoneAreaCode": "415" } ], "PaymentTerms": { "Bills": { "Day": 15, "Type": "OFCURRENTMONTH" }, "Sales": { "Day": 10, "Type": "DAYSAFTERBILLMONTH" } } } ] }; // Contacts | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            Contacts result = apiInstance.updateOrCreateContacts(xeroTenantId, contacts, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateContacts");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Contacts *contacts = { "Contacts": [ { "Name": "Bruce Banner", "EmailAddress": "hulk@avengers.com", "Phones": [ { "PhoneType": "MOBILE", "PhoneNumber": "555-1212", "PhoneAreaCode": "415" } ], "PaymentTerms": { "Bills": { "Day": 15, "Type": "OFCURRENTMONTH" }, "Sales": { "Day": 10, "Type": "DAYSAFTERBILLMONTH" } } } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates or creates one or more contacts in a Xero organisation
[apiInstance updateOrCreateContactsWith:xeroTenantId
    contacts:contacts
    summarizeErrors:summarizeErrors
              completionHandler: ^(Contacts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;

const phone: Phone = { 
    phoneNumber: "555-1212",
    phoneType: Phone.PhoneTypeEnum.MOBILE };   
const phones = [];    
phones.push(phone)

const contact: Contact = { 
    name: "Bruce Banner",
    emailAddress: "hulk@avengers.com",
    phones: phones }; 

const contacts: Contacts = {  
    contacts: [contact] }; 

try {
  const response = await xero.accountingApi.updateOrCreateContacts(xeroTenantId, contacts,  summarizeErrors);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateOrCreateContactsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;

            var phone = new Phone();
            phone.PhoneNumber = "555-1212";
            phone.PhoneType = Phone.PhoneTypeEnum.MOBILE;
            var phones = new List<Phone>();
            phones.Add(phone);

            var contact = new Contact();
            contact.Name = "Bruce Banner";
            contact.EmailAddress = "hulk@avengers.com";
            contact.Phones = phones;

            var contacts = new Contacts();
            var contactsList = new List<Contact>();
            contactsList.Add(contact); 
            contacts._Contacts = contactsList;
            
            try {
                var result = await apiInstance.UpdateOrCreateContactsAsync(accessToken, xeroTenantId, contacts, summarizeErrors);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateOrCreateContacts: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;

$phone = new XeroAPI\XeroPHP\Models\Accounting\Phone;
$phone->setPhoneNumber('555-1212');
$phone->setPhoneType(XeroAPI\XeroPHP\Models\Accounting\Phone::PHONE_TYPE_MOBILE);
$phones = [];
array_push($phones, $phone);

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setName('Bruce Banner');
$contact->setEmailAddress('hulk@avengers.com');
$contact->setPhones($phones);

$contacts = new XeroAPI\XeroPHP\Models\Accounting\Contacts;
$arr_contacts = [];
array_push($arr_contacts, $contact);
$contacts->setContacts($arr_contacts);

try {
  $result = $apiInstance->updateOrCreateContacts($xeroTenantId, $contacts, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateOrCreateContacts: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $contacts = ::Object::Contacts->new(); # Contacts | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->updateOrCreateContacts(xeroTenantId => $xeroTenantId, contacts => $contacts, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateOrCreateContacts: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_or_create_contacts():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'

    phone = Phone(
        phone_number = "555-1212",
        phone_type = "MOBILE")
    
    phones = []    
    phones.append(phone)

    contact = Contact(
        name = "Bruce Banner",
        email_address = "hulk@avengers.com",
        phones = phones)

    contacts = Contacts( 
        contacts = [contact])
    
    try:
        api_response = api_instance.update_or_create_contacts(xero_tenant_id, contacts, summarize_errors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateOrCreateContacts: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let contacts = { "Contacts": [ { "Name": "Bruce Banner", "EmailAddress": "hulk@avengers.com", "Phones": [ { "PhoneType": "MOBILE", "PhoneNumber": "555-1212", "PhoneAreaCode": "415" } ], "PaymentTerms": { "Bills": { "Day": 15, "Type": "OFCURRENTMONTH" }, "Sales": { "Day": 10, "Type": "DAYSAFTERBILLMONTH" } } } ] }; // Contacts
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.updateOrCreateContacts(xeroTenantId, contacts, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.contacts Grant read-write access to contacts and contact groups

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
contacts *
Contacts
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

updateOrCreateCreditNotes

Updates or creates one or more credit notes


/CreditNotes

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/CreditNotes?summarizeErrors=true&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        Boolean summarizeErrors = true;
        Integer unitdp = 4;
        LocalDate currDate = LocalDate.now();
        
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");

        List<LineItem> lineItems = new ArrayList<LineItem>();
        lineItems.add(lineItem);
        
        CreditNote creditNote = new CreditNote();
        creditNote.setType(com.xero.models.accounting.CreditNote.TypeEnum.ACCPAYCREDIT);
        creditNote.setContact(contact);
        creditNote.setDate(currDate);
        creditNote.setLineItems(lineItems);
        
        CreditNotes creditNotes = new CreditNotes();
        creditNotes.addCreditNotesItem(creditNote);

        try {
            CreditNotes result = apiInstance.updateOrCreateCreditNotes(accessToken, xeroTenantId, creditNotes, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateCreditNotes");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        CreditNotes creditNotes = { "CreditNotes":[ { "Type":"ACCPAYCREDIT", "Contact":{ "ContactID":"430fa14a-f945-44d3-9f97-5df5e28441b8" }, "Date":"2019-01-05", "Status":"AUTHORISED", "Reference": "HelloWorld", "LineItems":[ { "Description":"Foobar", "Quantity":2.0, "UnitAmount":20.0, "AccountCode":"400" } ] } ] }; // CreditNotes | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            CreditNotes result = apiInstance.updateOrCreateCreditNotes(xeroTenantId, creditNotes, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateCreditNotes");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
CreditNotes *creditNotes = { "CreditNotes":[ { "Type":"ACCPAYCREDIT", "Contact":{ "ContactID":"430fa14a-f945-44d3-9f97-5df5e28441b8" }, "Date":"2019-01-05", "Status":"AUTHORISED", "Reference": "HelloWorld", "LineItems":[ { "Description":"Foobar", "Quantity":2.0, "UnitAmount":20.0, "AccountCode":"400" } ] } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates or creates one or more credit notes
[apiInstance updateOrCreateCreditNotesWith:xeroTenantId
    creditNotes:creditNotes
    summarizeErrors:summarizeErrors
    unitdp:unitdp
              completionHandler: ^(CreditNotes output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;
const unitdp = 4;
const currDate = '2020-12-10'

const contact: Contact = { 
    contactID: "00000000-0000-0000-0000-000000000000" }; 

const lineItem: LineItem = { 
    description: "Foobar",
    quantity: 1.0,
    unitAmount: 20.0,
    accountCode: "000" };   
const lineItems = [];    
lineItems.push(lineItem)

const creditNote: CreditNote = { 
    type: CreditNote.TypeEnum.ACCPAYCREDIT,
    contact: contact,
    date: currDate,
    lineItems: lineItems }; 

const creditNotes: CreditNotes = {  
    creditNotes: [creditNote] }; 

try {
  const response = await xero.accountingApi.updateOrCreateCreditNotes(xeroTenantId, creditNotes,  summarizeErrors, unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateOrCreateCreditNotesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;
            var unitdp = 4;
            var currDate = DateTime.Now;

            var contact = new Contact();
            contact.ContactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var lineItem = new LineItem();
            lineItem.Description = "Foobar";
            lineItem.Quantity = new decimal(1.0);
            lineItem.UnitAmount = new decimal(20.0);
            lineItem.AccountCode = "000";
            var lineItems = new List<LineItem>();
            lineItems.Add(lineItem);

            var creditNote = new CreditNote();
            creditNote.Type = CreditNote.TypeEnum.ACCPAYCREDIT;
            creditNote.Contact = contact;
            creditNote.Date = currDate;
            creditNote.LineItems = lineItems;

            var creditNotes = new CreditNotes();
            var creditNotesList = new List<CreditNote>();
            creditNotesList.Add(creditNote); 
            creditNotes._CreditNotes = creditNotesList;
            
            try {
                var result = await apiInstance.UpdateOrCreateCreditNotesAsync(accessToken, xeroTenantId, creditNotes, summarizeErrors, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateOrCreateCreditNotes: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$unitdp = 4;
$currDate = new DateTime('2020-12-10');

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItems = [];
array_push($lineItems, $lineItem);

$creditNote = new XeroAPI\XeroPHP\Models\Accounting\CreditNote;
$creditNote->setType(XeroAPI\XeroPHP\Models\Accounting\CreditNote::TYPE_ACCPAYCREDIT);
$creditNote->setContact($contact);
$creditNote->setDate($currDate);
$creditNote->setLineItems($lineItems);

$creditNotes = new XeroAPI\XeroPHP\Models\Accounting\CreditNotes;
$arr_credit_notes = [];
array_push($arr_credit_notes, $creditNote);
$creditNotes->setCreditNotes($arr_credit_notes);

try {
  $result = $apiInstance->updateOrCreateCreditNotes($xeroTenantId, $creditNotes, $summarizeErrors, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateOrCreateCreditNotes: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $creditNotes = ::Object::CreditNotes->new(); # CreditNotes | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->updateOrCreateCreditNotes(xeroTenantId => $xeroTenantId, creditNotes => $creditNotes, summarizeErrors => $summarizeErrors, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateOrCreateCreditNotes: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_or_create_credit_notes():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'
    curr_date = dateutil.parser.parse('2020-12-03T00:00:00Z')

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000")
    
    line_items = []    
    line_items.append(line_item)

    credit_note = CreditNote(
        type = "ACCPAYCREDIT",
        contact = contact,
        date = curr_date,
        line_items = line_items)

    creditNotes = CreditNotes( 
        credit_notes = [credit_note])
    
    try:
        api_response = api_instance.update_or_create_credit_notes(xero_tenant_id, creditNotes, summarize_errors, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateOrCreateCreditNotes: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let creditNotes = { "CreditNotes":[ { "Type":"ACCPAYCREDIT", "Contact":{ "ContactID":"430fa14a-f945-44d3-9f97-5df5e28441b8" }, "Date":"2019-01-05", "Status":"AUTHORISED", "Reference": "HelloWorld", "LineItems":[ { "Description":"Foobar", "Quantity":2.0, "UnitAmount":20.0, "AccountCode":"400" } ] } ] }; // CreditNotes
    let summarizeErrors = true; // Boolean
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.updateOrCreateCreditNotes(xeroTenantId, creditNotes, summarizeErrors, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
creditNotes *
CreditNotes
an array of Credit Notes with a single CreditNote object.
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

updateOrCreateEmployees

Creates a single new employees used in Xero payrun


/Employees

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Employees?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        Boolean summarizeErrors = true;
        
        Employee employee = new Employee();
        employee.setFirstName("Nick");
        employee.setLastName("Fury");
        
        Employees employees = new Employees();
        employees.addEmployeesItem(employee);

        try {
            Employees result = apiInstance.updateOrCreateEmployees(accessToken, xeroTenantId, employees, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateEmployees");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Employees employees = { "Employees": [ { "FirstName": "Nick", "LastName": "Fury", "ExternalLink": { "Url": "http://twitter.com/#!/search/Nick+Fury" } } ] }; // Employees | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            Employees result = apiInstance.updateOrCreateEmployees(xeroTenantId, employees, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateEmployees");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Employees *employees = { "Employees": [ { "FirstName": "Nick", "LastName": "Fury", "ExternalLink": { "Url": "http://twitter.com/#!/search/Nick+Fury" } } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Creates a single new employees used in Xero payrun
[apiInstance updateOrCreateEmployeesWith:xeroTenantId
    employees:employees
    summarizeErrors:summarizeErrors
              completionHandler: ^(Employees output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;

const employee: Employee = { 
    firstName: "Nick",
    lastName: "Fury" }; 

const employees: Employees = {  
    employees: [employee] }; 

try {
  const response = await xero.accountingApi.updateOrCreateEmployees(xeroTenantId, employees,  summarizeErrors);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateOrCreateEmployeesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;

            var employee = new Employee();
            employee.FirstName = "Nick";
            employee.LastName = "Fury";

            var employees = new Employees();
            var employeesList = new List<Employee>();
            employeesList.Add(employee); 
            employees._Employees = employeesList;
            
            try {
                var result = await apiInstance.UpdateOrCreateEmployeesAsync(accessToken, xeroTenantId, employees, summarizeErrors);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateOrCreateEmployees: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;

$employee = new XeroAPI\XeroPHP\Models\Accounting\Employee;
$employee->setFirstName('Nick');
$employee->setLastName('Fury');

$employees = new XeroAPI\XeroPHP\Models\Accounting\Employees;
$arr_employees = [];
array_push($arr_employees, $employee);
$employees->setEmployees($arr_employees);

try {
  $result = $apiInstance->updateOrCreateEmployees($xeroTenantId, $employees, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateOrCreateEmployees: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $employees = ::Object::Employees->new(); # Employees | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->updateOrCreateEmployees(xeroTenantId => $xeroTenantId, employees => $employees, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateOrCreateEmployees: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_or_create_employees():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'

    employee = Employee(
        first_name = "Nick",
        last_name = "Fury")

    employees = Employees( 
        employees = [employee])
    
    try:
        api_response = api_instance.update_or_create_employees(xero_tenant_id, employees, summarize_errors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateOrCreateEmployees: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let employees = { "Employees": [ { "FirstName": "Nick", "LastName": "Fury", "ExternalLink": { "Url": "http://twitter.com/#!/search/Nick+Fury" } } ] }; // Employees
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.updateOrCreateEmployees(xeroTenantId, employees, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
employees *
Employees
Employees with array of Employee object in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

updateOrCreateInvoices

Updates or creates one or more sales invoices or purchase bills


/Invoices

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Invoices?summarizeErrors=true&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        Boolean summarizeErrors = true;
        Integer unitdp = 4;
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);
        LocalDate dueDateValue = LocalDate.of(2020, Month.OCTOBER, 28);
        
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");

        List<LineItem> lineItems = new ArrayList<LineItem>();
        lineItems.add(lineItem);
        
        Invoice invoice = new Invoice();
        invoice.setType(com.xero.models.accounting.Invoice.TypeEnum.ACCREC);
        invoice.setContact(contact);
        invoice.setDate(dateValue);
        invoice.setDate(dueDateValue);
        invoice.setLineItems(lineItems);
        invoice.setReference("Website Design");
        invoice.setStatus(com.xero.models.accounting.Invoice.StatusEnum.DRAFT);
        
        Invoices invoices = new Invoices();
        invoices.addInvoicesItem(invoice);

        try {
            Invoices result = apiInstance.updateOrCreateInvoices(accessToken, xeroTenantId, invoices, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateInvoices");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Invoices invoices = { "Invoices": [ { "Type": "ACCREC", "Contact": { "ContactID": "430fa14a-f945-44d3-9f97-5df5e28441b8" }, "LineItems": [ { "Description": "Acme Tires", "Quantity": 2, "UnitAmount": 20, "AccountCode": "200", "TaxType": "NONE", "LineAmount": 40 } ], "Date": "2019-03-11", "DueDate": "2018-12-10", "Reference": "Website Design", "Status": "AUTHORISED" } ] }; // Invoices | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Invoices result = apiInstance.updateOrCreateInvoices(xeroTenantId, invoices, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateInvoices");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Invoices *invoices = { "Invoices": [ { "Type": "ACCREC", "Contact": { "ContactID": "430fa14a-f945-44d3-9f97-5df5e28441b8" }, "LineItems": [ { "Description": "Acme Tires", "Quantity": 2, "UnitAmount": 20, "AccountCode": "200", "TaxType": "NONE", "LineAmount": 40 } ], "Date": "2019-03-11", "DueDate": "2018-12-10", "Reference": "Website Design", "Status": "AUTHORISED" } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates or creates one or more sales invoices or purchase bills
[apiInstance updateOrCreateInvoicesWith:xeroTenantId
    invoices:invoices
    summarizeErrors:summarizeErrors
    unitdp:unitdp
              completionHandler: ^(Invoices output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;
const unitdp = 4;
const dateValue = '2020-10-10'
const dueDateValue = '2020-10-28'

const contact: Contact = { 
    contactID: "00000000-0000-0000-0000-000000000000" }; 

const lineItem: LineItem = { 
    description: "Foobar",
    quantity: 1.0,
    unitAmount: 20.0,
    accountCode: "000" };   
const lineItems = [];    
lineItems.push(lineItem)

const invoice: Invoice = { 
    type: Invoice.TypeEnum.ACCREC,
    contact: contact,
    date: dateValue,
    dueDate: dueDateValue,
    lineItems: lineItems,
    reference: "Website Design",
    status: Invoice.StatusEnum.DRAFT }; 

const invoices: Invoices = {  
    invoices: [invoice] }; 

try {
  const response = await xero.accountingApi.updateOrCreateInvoices(xeroTenantId, invoices,  summarizeErrors, unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateOrCreateInvoicesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;
            var unitdp = 4;
            var dateValue = new DateTime(2020, 10, 10);
            var dueDateValue = new DateTime(2020, 10, 10);

            var contact = new Contact();
            contact.ContactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var lineItem = new LineItem();
            lineItem.Description = "Foobar";
            lineItem.Quantity = new decimal(1.0);
            lineItem.UnitAmount = new decimal(20.0);
            lineItem.AccountCode = "000";
            var lineItems = new List<LineItem>();
            lineItems.Add(lineItem);

            var invoice = new Invoice();
            invoice.Type = Invoice.TypeEnum.ACCREC;
            invoice.Contact = contact;
            invoice.Date = dateValue;
            invoice.Date = dueDateValue;
            invoice.LineItems = lineItems;
            invoice.Reference = "Website Design";
            invoice.Status = Invoice.StatusEnum.DRAFT;

            var invoices = new Invoices();
            var invoicesList = new List<Invoice>();
            invoicesList.Add(invoice); 
            invoices._Invoices = invoicesList;
            
            try {
                var result = await apiInstance.UpdateOrCreateInvoicesAsync(accessToken, xeroTenantId, invoices, summarizeErrors, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateOrCreateInvoices: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$unitdp = 4;
$dateValue = new DateTime('2020-10-10');
$dueDateValue = new DateTime('2020-10-28');

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItems = [];
array_push($lineItems, $lineItem);

$invoice = new XeroAPI\XeroPHP\Models\Accounting\Invoice;
$invoice->setType(XeroAPI\XeroPHP\Models\Accounting\Invoice::TYPE_ACCREC);
$invoice->setContact($contact);
$invoice->setDate($dateValue);
$invoice->setDate($dueDateValue);
$invoice->setLineItems($lineItems);
$invoice->setReference('Website Design');
$invoice->setStatus(XeroAPI\XeroPHP\Models\Accounting\Invoice::STATUS_DRAFT);

$invoices = new XeroAPI\XeroPHP\Models\Accounting\Invoices;
$arr_invoices = [];
array_push($arr_invoices, $invoice);
$invoices->setInvoices($arr_invoices);

try {
  $result = $apiInstance->updateOrCreateInvoices($xeroTenantId, $invoices, $summarizeErrors, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateOrCreateInvoices: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $invoices = ::Object::Invoices->new(); # Invoices | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->updateOrCreateInvoices(xeroTenantId => $xeroTenantId, invoices => $invoices, summarizeErrors => $summarizeErrors, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateOrCreateInvoices: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_or_create_invoices():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'
    date_value = dateutil.parser.parse('2020-10-10T00:00:00Z')
    due_date_value = dateutil.parser.parse('2020-10-28T00:00:00Z')

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000")
    
    line_items = []    
    line_items.append(line_item)

    invoice = Invoice(
        type = "ACCREC",
        contact = contact,
        date = date_value,
        due_date = due_date_value,
        line_items = line_items,
        reference = "Website Design",
        status = "DRAFT")

    invoices = Invoices( 
        invoices = [invoice])
    
    try:
        api_response = api_instance.update_or_create_invoices(xero_tenant_id, invoices, summarize_errors, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateOrCreateInvoices: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let invoices = { "Invoices": [ { "Type": "ACCREC", "Contact": { "ContactID": "430fa14a-f945-44d3-9f97-5df5e28441b8" }, "LineItems": [ { "Description": "Acme Tires", "Quantity": 2, "UnitAmount": 20, "AccountCode": "200", "TaxType": "NONE", "LineAmount": 40 } ], "Date": "2019-03-11", "DueDate": "2018-12-10", "Reference": "Website Design", "Status": "AUTHORISED" } ] }; // Invoices
    let summarizeErrors = true; // Boolean
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.updateOrCreateInvoices(xeroTenantId, invoices, summarizeErrors, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
invoices *
Invoices
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

updateOrCreateItems

Updates or creates one or more items


/Items

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Items?summarizeErrors=true&unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        Boolean summarizeErrors = true;
        Integer unitdp = 4;
        
        Item item = new Item();
        item.setCode("abcXYZ123");
        item.setName("HelloWorld");
        item.setDescription("Foobar");
        
        Items items = new Items();
        items.addItemsItem(item);

        try {
            Items result = apiInstance.updateOrCreateItems(accessToken, xeroTenantId, items, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateItems");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Items items = { "Items": [ { "Code": "ItemCode123", "Name": "ItemName XYZ", "Description": "Item Description ABC" } ] }; // Items | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Items result = apiInstance.updateOrCreateItems(xeroTenantId, items, summarizeErrors, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateItems");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Items *items = { "Items": [ { "Code": "ItemCode123", "Name": "ItemName XYZ", "Description": "Item Description ABC" } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates or creates one or more items
[apiInstance updateOrCreateItemsWith:xeroTenantId
    items:items
    summarizeErrors:summarizeErrors
    unitdp:unitdp
              completionHandler: ^(Items output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;
const unitdp = 4;

const item: Item = { 
    code: "abcXYZ123",
    name: "HelloWorld",
    description: "Foobar" }; 

const items: Items = {  
    items: [item] }; 

try {
  const response = await xero.accountingApi.updateOrCreateItems(xeroTenantId, items,  summarizeErrors, unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateOrCreateItemsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;
            var unitdp = 4;

            var item = new Item();
            item.Code = "abcXYZ123";
            item.Name = "HelloWorld";
            item.Description = "Foobar";

            var items = new Items();
            var itemsList = new List<Item>();
            itemsList.Add(item); 
            items._Items = itemsList;
            
            try {
                var result = await apiInstance.UpdateOrCreateItemsAsync(accessToken, xeroTenantId, items, summarizeErrors, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateOrCreateItems: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$unitdp = 4;

$item = new XeroAPI\XeroPHP\Models\Accounting\Item;
$item->setCode('abcXYZ123');
$item->setName('HelloWorld');
$item->setDescription('Foobar');

$items = new XeroAPI\XeroPHP\Models\Accounting\Items;
$arr_items = [];
array_push($arr_items, $item);
$items->setItems($arr_items);

try {
  $result = $apiInstance->updateOrCreateItems($xeroTenantId, $items, $summarizeErrors, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateOrCreateItems: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $items = ::Object::Items->new(); # Items | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->updateOrCreateItems(xeroTenantId => $xeroTenantId, items => $items, summarizeErrors => $summarizeErrors, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateOrCreateItems: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_or_create_items():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'

    item = Item(
        code = "abcXYZ123",
        name = "HelloWorld",
        description = "Foobar")

    items = Items( 
        items = [item])
    
    try:
        api_response = api_instance.update_or_create_items(xero_tenant_id, items, summarize_errors, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateOrCreateItems: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let items = { "Items": [ { "Code": "ItemCode123", "Name": "ItemName XYZ", "Description": "Item Description ABC" } ] }; // Items
    let summarizeErrors = true; // Boolean
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.updateOrCreateItems(xeroTenantId, items, summarizeErrors, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
items *
Items
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

updateOrCreateManualJournals

Updates or creates a single manual journal


/ManualJournals

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/ManualJournals?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        Boolean summarizeErrors = true;
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);

        List<ManualJournalLine> manualJournalLines = new ArrayList<ManualJournalLine>();
        
        ManualJournalLine credit = new ManualJournalLine();
        credit.setLineAmount(100.0);
        credit.setAccountCode("400");
        credit.setDescription("Hello there");
        manualJournalLines.add(credit);
        
        ManualJournalLine debit = new ManualJournalLine();
        debit.setLineAmount(-100.0);
        debit.setAccountCode("120");
        debit.setDescription("Hello there");
        manualJournalLines.add(debit);
        
        ManualJournal manualJournal = new ManualJournal();
        manualJournal.setNarration("Foobar");
        manualJournal.setDate(dateValue);
        manualJournal.setJournalLines(manualJournalLines);
        
        ManualJournals manualJournals = new ManualJournals();
        manualJournals.addManualJournalsItem(manualJournal);

        try {
            ManualJournals result = apiInstance.updateOrCreateManualJournals(accessToken, xeroTenantId, manualJournals, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateManualJournals");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        ManualJournals manualJournals = { "ManualJournals": [ { "Narration": "Journal Desc", "JournalLines": [ { "LineAmount": 100, "AccountCode": "400", "Description": "Money Movement" }, { "LineAmount": -100, "AccountCode": "400", "Description": "Prepayment of things", "Tracking": [ { "Name": "North", "Option": "Region" } ] } ], "Date": "2019-03-14" } ] }; // ManualJournals | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            ManualJournals result = apiInstance.updateOrCreateManualJournals(xeroTenantId, manualJournals, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateManualJournals");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
ManualJournals *manualJournals = { "ManualJournals": [ { "Narration": "Journal Desc", "JournalLines": [ { "LineAmount": 100, "AccountCode": "400", "Description": "Money Movement" }, { "LineAmount": -100, "AccountCode": "400", "Description": "Prepayment of things", "Tracking": [ { "Name": "North", "Option": "Region" } ] } ], "Date": "2019-03-14" } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates or creates a single manual journal
[apiInstance updateOrCreateManualJournalsWith:xeroTenantId
    manualJournals:manualJournals
    summarizeErrors:summarizeErrors
              completionHandler: ^(ManualJournals output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;
const dateValue = '2020-10-10'  
const manualJournalLines = [];

const credit: ManualJournalLine = { 
    lineAmount: 100.0,
    accountCode: "400",
    description: "Hello there" };     
manualJournalLines.push(credit)

const debit: ManualJournalLine = { 
    lineAmount: -100.0,
    accountCode: "120",
    description: "Hello there" };     
manualJournalLines.push(debit)

const manualJournal: ManualJournal = { 
    narration: "Foobar",
    date: dateValue,
    manualJournalLines: manualJournalLines }; 

const manualJournals: ManualJournals = {  
    manualJournals: [manualJournal] }; 

try {
  const response = await xero.accountingApi.updateOrCreateManualJournals(xeroTenantId, manualJournals,  summarizeErrors);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateOrCreateManualJournalsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;
            var dateValue = new DateTime(2020, 10, 10);
            var manualJournalLines = new List<ManualJournalLine>();

            var credit = new ManualJournalLine();
            credit.LineAmount = new decimal(100.0);
            credit.AccountCode = "400";
            credit.Description = "Hello there";
            manualJournalLines.Add(credit);

            var debit = new ManualJournalLine();
            debit.LineAmount = new decimal(-100.0);
            debit.AccountCode = "120";
            debit.Description = "Hello there";
            manualJournalLines.Add(debit);

            var manualJournal = new ManualJournal();
            manualJournal.Narration = "Foobar";
            manualJournal.Date = dateValue;
            manualJournal.JournalLines = manualJournalLines;

            var manualJournals = new ManualJournals();
            var manualJournalsList = new List<ManualJournal>();
            manualJournalsList.Add(manualJournal); 
            manualJournals._ManualJournals = manualJournalsList;
            
            try {
                var result = await apiInstance.UpdateOrCreateManualJournalsAsync(accessToken, xeroTenantId, manualJournals, summarizeErrors);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateOrCreateManualJournals: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$dateValue = new DateTime('2020-10-10');
$manualJournalLines = [];

$credit = new XeroAPI\XeroPHP\Models\Accounting\ManualJournalLine;
$credit->setLineAmount(100.0);
$credit->setAccountCode('400');
$credit->setDescription('Hello there');
array_push($manualJournalLines, $credit);

$debit = new XeroAPI\XeroPHP\Models\Accounting\ManualJournalLine;
$debit->setLineAmount(-100.0);
$debit->setAccountCode('120');
$debit->setDescription('Hello there');
array_push($manualJournalLines, $debit);

$manualJournal = new XeroAPI\XeroPHP\Models\Accounting\ManualJournal;
$manualJournal->setNarration('Foobar');
$manualJournal->setDate($dateValue);
$manualJournal->setJournalLines($manualJournalLines);

$manualJournals = new XeroAPI\XeroPHP\Models\Accounting\ManualJournals;
$arr_manual_journals = [];
array_push($arr_manual_journals, $manualJournal);
$manualJournals->setManualJournals($arr_manual_journals);

try {
  $result = $apiInstance->updateOrCreateManualJournals($xeroTenantId, $manualJournals, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateOrCreateManualJournals: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $manualJournals = ::Object::ManualJournals->new(); # ManualJournals | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->updateOrCreateManualJournals(xeroTenantId => $xeroTenantId, manualJournals => $manualJournals, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateOrCreateManualJournals: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_or_create_manual_journals():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'
    date_value = dateutil.parser.parse('2020-12-03T00:00:00Z')
    
    manual_journal_lines = []

    credit = ManualJournalLine(
        line_amount = 100.0,
        account_code = "400",
        description = "Hello there")    
    manual_journal_lines.append(credit)

    debit = ManualJournalLine(
        line_amount = -100.0,
        account_code = "120",
        description = "Hello there")    
    manual_journal_lines.append(debit)

    manual_journal = ManualJournal(
        narration = "Foobar",
        date = date_value,
        journal_lines = manual_journal_lines)

    manualJournals = ManualJournals( 
        manual_journals = [manual_journal])
    
    try:
        api_response = api_instance.update_or_create_manual_journals(xero_tenant_id, manualJournals, summarize_errors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateOrCreateManualJournals: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let manualJournals = { "ManualJournals": [ { "Narration": "Journal Desc", "JournalLines": [ { "LineAmount": 100, "AccountCode": "400", "Description": "Money Movement" }, { "LineAmount": -100, "AccountCode": "400", "Description": "Prepayment of things", "Tracking": [ { "Name": "North", "Option": "Region" } ] } ], "Date": "2019-03-14" } ] }; // ManualJournals
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.updateOrCreateManualJournals(xeroTenantId, manualJournals, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
manualJournals *
ManualJournals
ManualJournals array with ManualJournal object in body of request
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

updateOrCreatePurchaseOrders

Updates or creates one or more purchase orders


/PurchaseOrders

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        Boolean summarizeErrors = true;
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);
        
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");

        List<LineItem> lineItems = new ArrayList<LineItem>();
        lineItems.add(lineItem);
        
        PurchaseOrder purchaseOrder = new PurchaseOrder();
        purchaseOrder.setContact(contact);
        purchaseOrder.setLineItems(lineItems);
        purchaseOrder.setDate(dateValue);
        
        PurchaseOrders purchaseOrders = new PurchaseOrders();
        purchaseOrders.addPurchaseOrdersItem(purchaseOrder);

        try {
            PurchaseOrders result = apiInstance.updateOrCreatePurchaseOrders(accessToken, xeroTenantId, purchaseOrders, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreatePurchaseOrders");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        PurchaseOrders purchaseOrders = { "PurchaseOrders": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "LineItems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "710" } ], "Date": "2019-03-13" } ] }; // PurchaseOrders | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            PurchaseOrders result = apiInstance.updateOrCreatePurchaseOrders(xeroTenantId, purchaseOrders, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreatePurchaseOrders");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
PurchaseOrders *purchaseOrders = { "PurchaseOrders": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "LineItems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "710" } ], "Date": "2019-03-13" } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates or creates one or more purchase orders
[apiInstance updateOrCreatePurchaseOrdersWith:xeroTenantId
    purchaseOrders:purchaseOrders
    summarizeErrors:summarizeErrors
              completionHandler: ^(PurchaseOrders output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;
const dateValue = '2020-10-10'

const contact: Contact = { 
    contactID: "00000000-0000-0000-0000-000000000000" }; 

const lineItem: LineItem = { 
    description: "Foobar",
    quantity: 1.0,
    unitAmount: 20.0,
    accountCode: "000" };   
const lineItems = [];    
lineItems.push(lineItem)

const purchaseOrder: PurchaseOrder = { 
    contact: contact,
    lineItems: lineItems,
    date: dateValue }; 

const purchaseOrders: PurchaseOrders = {  
    purchaseOrders: [purchaseOrder] }; 

try {
  const response = await xero.accountingApi.updateOrCreatePurchaseOrders(xeroTenantId, purchaseOrders,  summarizeErrors);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateOrCreatePurchaseOrdersExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;
            var dateValue = DateTime.Now;

            var contact = new Contact();
            contact.ContactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var lineItem = new LineItem();
            lineItem.Description = "Foobar";
            lineItem.Quantity = new decimal(1.0);
            lineItem.UnitAmount = new decimal(20.0);
            lineItem.AccountCode = "000";
            var lineItems = new List<LineItem>();
            lineItems.Add(lineItem);

            var purchaseOrder = new PurchaseOrder();
            purchaseOrder.Contact = contact;
            purchaseOrder.LineItems = lineItems;
            purchaseOrder.Date = dateValue;

            var purchaseOrders = new PurchaseOrders();
            var purchaseOrdersList = new List<PurchaseOrder>();
            purchaseOrdersList.Add(purchaseOrder); 
            purchaseOrders._PurchaseOrders = purchaseOrdersList;
            
            try {
                var result = await apiInstance.UpdateOrCreatePurchaseOrdersAsync(accessToken, xeroTenantId, purchaseOrders, summarizeErrors);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateOrCreatePurchaseOrders: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$dateValue = new DateTime('2020-12-10');

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItems = [];
array_push($lineItems, $lineItem);

$purchaseOrder = new XeroAPI\XeroPHP\Models\Accounting\PurchaseOrder;
$purchaseOrder->setContact($contact);
$purchaseOrder->setLineItems($lineItems);
$purchaseOrder->setDate($dateValue);

$purchaseOrders = new XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders;
$arr_purchase_orders = [];
array_push($arr_purchase_orders, $purchaseOrder);
$purchaseOrders->setPurchaseOrders($arr_purchase_orders);

try {
  $result = $apiInstance->updateOrCreatePurchaseOrders($xeroTenantId, $purchaseOrders, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateOrCreatePurchaseOrders: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrders = ::Object::PurchaseOrders->new(); # PurchaseOrders | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->updateOrCreatePurchaseOrders(xeroTenantId => $xeroTenantId, purchaseOrders => $purchaseOrders, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateOrCreatePurchaseOrders: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_or_create_purchase_orders():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'
    date_value = dateutil.parser.parse('2020-12-03T00:00:00Z')

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000")
    
    line_items = []    
    line_items.append(line_item)

    purchase_order = PurchaseOrder(
        contact = contact,
        line_items = line_items,
        date = date_value)

    purchaseOrders = PurchaseOrders( 
        purchase_orders = [purchase_order])
    
    try:
        api_response = api_instance.update_or_create_purchase_orders(xero_tenant_id, purchaseOrders, summarize_errors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateOrCreatePurchaseOrders: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrders = { "PurchaseOrders": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "LineItems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "710" } ], "Date": "2019-03-13" } ] }; // PurchaseOrders
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.updateOrCreatePurchaseOrders(xeroTenantId, purchaseOrders, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
purchaseOrders *
PurchaseOrders
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

updateOrCreateQuotes

Updates or creates one or more quotes


/Quotes

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes?summarizeErrors=true"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        Boolean summarizeErrors = true;
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);
        
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        LineItem lineItem = new LineItem();
        lineItem.setDescription("Foobar");
        lineItem.setQuantity(1.0);
        lineItem.setUnitAmount(20.0);
        lineItem.setAccountCode("000");

        List<LineItem> lineItems = new ArrayList<LineItem>();
        lineItems.add(lineItem);
        
        Quote quote = new Quote();
        quote.setContact(contact);
        quote.setLineItems(lineItems);
        quote.setDate(dateValue);
        
        Quotes quotes = new Quotes();
        quotes.addQuotesItem(quote);

        try {
            Quotes result = apiInstance.updateOrCreateQuotes(accessToken, xeroTenantId, quotes, summarizeErrors);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateQuotes");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        Quotes quotes = { "Quotes": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "LineItems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "12775" } ], "Date": "2020-02-01" } ] }; // Quotes | 
        Boolean summarizeErrors = true; // Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors
        try {
            Quotes result = apiInstance.updateOrCreateQuotes(xeroTenantId, quotes, summarizeErrors);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateOrCreateQuotes");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
Quotes *quotes = { "Quotes": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "LineItems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "12775" } ], "Date": "2020-02-01" } ] }; // 
Boolean *summarizeErrors = true; // If false return 200 OK and mix of successfully created objects and any with validation errors (optional) (default to false)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates or creates one or more quotes
[apiInstance updateOrCreateQuotesWith:xeroTenantId
    quotes:quotes
    summarizeErrors:summarizeErrors
              completionHandler: ^(Quotes output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const summarizeErrors = true;
const dateValue = '2020-10-10'

const contact: Contact = { 
    contactID: "00000000-0000-0000-0000-000000000000" }; 

const lineItem: LineItem = { 
    description: "Foobar",
    quantity: 1.0,
    unitAmount: 20.0,
    accountCode: "000" };   
const lineItems = [];    
lineItems.push(lineItem)

const quote: Quote = { 
    contact: contact,
    lineItems: lineItems,
    date: dateValue }; 

const quotes: Quotes = {  
    quotes: [quote] }; 

try {
  const response = await xero.accountingApi.updateOrCreateQuotes(xeroTenantId, quotes,  summarizeErrors);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateOrCreateQuotesExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var summarizeErrors = true;
            var dateValue = DateTime.Now;

            var contact = new Contact();
            contact.ContactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var lineItem = new LineItem();
            lineItem.Description = "Foobar";
            lineItem.Quantity = new decimal(1.0);
            lineItem.UnitAmount = new decimal(20.0);
            lineItem.AccountCode = "000";
            var lineItems = new List<LineItem>();
            lineItems.Add(lineItem);

            var quote = new Quote();
            quote.Contact = contact;
            quote.LineItems = lineItems;
            quote.Date = dateValue;

            var quotes = new Quotes();
            var quotesList = new List<Quote>();
            quotesList.Add(quote); 
            quotes._Quotes = quotesList;
            
            try {
                var result = await apiInstance.UpdateOrCreateQuotesAsync(accessToken, xeroTenantId, quotes, summarizeErrors);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateOrCreateQuotes: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$summarizeErrors = true;
$dateValue = new DateTime('2020-12-10');

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$lineItem = new XeroAPI\XeroPHP\Models\Accounting\LineItem;
$lineItem->setDescription('Foobar');
$lineItem->setQuantity(1.0);
$lineItem->setUnitAmount(20.0);
$lineItem->setAccountCode('000');
$lineItems = [];
array_push($lineItems, $lineItem);

$quote = new XeroAPI\XeroPHP\Models\Accounting\Quote;
$quote->setContact($contact);
$quote->setLineItems($lineItems);
$quote->setDate($dateValue);

$quotes = new XeroAPI\XeroPHP\Models\Accounting\Quotes;
$arr_quotes = [];
array_push($arr_quotes, $quote);
$quotes->setQuotes($arr_quotes);

try {
  $result = $apiInstance->updateOrCreateQuotes($xeroTenantId, $quotes, $summarizeErrors);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateOrCreateQuotes: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $quotes = ::Object::Quotes->new(); # Quotes | 
my $summarizeErrors = true; # Boolean | If false return 200 OK and mix of successfully created objects and any with validation errors

eval { 
    my $result = $api_instance->updateOrCreateQuotes(xeroTenantId => $xeroTenantId, quotes => $quotes, summarizeErrors => $summarizeErrors);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateOrCreateQuotes: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_or_create_quotes():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    summarize_errors = 'True'
    date_value = dateutil.parser.parse('2020-12-03T00:00:00Z')

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    line_item = LineItem(
        description = "Foobar",
        quantity = 1.0,
        unit_amount = 20.0,
        account_code = "000")
    
    line_items = []    
    line_items.append(line_item)

    quote = Quote(
        contact = contact,
        line_items = line_items,
        date = date_value)

    quotes = Quotes( 
        quotes = [quote])
    
    try:
        api_response = api_instance.update_or_create_quotes(xero_tenant_id, quotes, summarize_errors)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateOrCreateQuotes: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let quotes = { "Quotes": [ { "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "LineItems": [ { "Description": "Foobar", "Quantity": 1, "UnitAmount": 20, "AccountCode": "12775" } ], "Date": "2020-02-01" } ] }; // Quotes
    let summarizeErrors = true; // Boolean

    let mut context = AccountingApi::Context::default();
    let result = client.updateOrCreateQuotes(xeroTenantId, quotes, summarizeErrors, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
quotes *
Quotes
Required
Query parameters
Name Description
summarizeErrors
Boolean
If false return 200 OK and mix of successfully created objects and any with validation errors

updatePurchaseOrder

Updates a specific purchase order


/PurchaseOrders/{PurchaseOrderID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders/{PurchaseOrderID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID purchaseOrderID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        PurchaseOrder purchaseOrder = new PurchaseOrder();
        purchaseOrder.setAttentionTo("Peter Parker");
        
        PurchaseOrders purchaseOrders = new PurchaseOrders();
        purchaseOrders.addPurchaseOrdersItem(purchaseOrder);

        try {
            PurchaseOrders result = apiInstance.updatePurchaseOrder(accessToken, xeroTenantId, purchaseOrderID, purchaseOrders);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updatePurchaseOrder");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Purchase Order
        PurchaseOrders purchaseOrders = { "PurchaseOrders": [ { "AttentionTo": "Peter Parker", "LineItems": [], "Contact": {} } ] }; // PurchaseOrders | 
        try {
            PurchaseOrders result = apiInstance.updatePurchaseOrder(xeroTenantId, purchaseOrderID, purchaseOrders);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updatePurchaseOrder");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *purchaseOrderID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Purchase Order (default to null)
PurchaseOrders *purchaseOrders = { "PurchaseOrders": [ { "AttentionTo": "Peter Parker", "LineItems": [], "Contact": {} } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific purchase order
[apiInstance updatePurchaseOrderWith:xeroTenantId
    purchaseOrderID:purchaseOrderID
    purchaseOrders:purchaseOrders
              completionHandler: ^(PurchaseOrders output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const purchaseOrderID = '00000000-0000-0000-0000-000000000000';

const purchaseOrder: PurchaseOrder = { 
    attentionTo: "Peter Parker" }; 

const purchaseOrders: PurchaseOrders = {  
    purchaseOrders: [purchaseOrder] }; 

try {
  const response = await xero.accountingApi.updatePurchaseOrder(xeroTenantId, purchaseOrderID, purchaseOrders);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdatePurchaseOrderExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var purchaseOrderID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var purchaseOrder = new PurchaseOrder();
            purchaseOrder.AttentionTo = "Peter Parker";

            var purchaseOrders = new PurchaseOrders();
            var purchaseOrdersList = new List<PurchaseOrder>();
            purchaseOrdersList.Add(purchaseOrder); 
            purchaseOrders._PurchaseOrders = purchaseOrdersList;
            
            try {
                var result = await apiInstance.UpdatePurchaseOrderAsync(accessToken, xeroTenantId, purchaseOrderID, purchaseOrders);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdatePurchaseOrder: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$purchaseOrderID = "00000000-0000-0000-0000-000000000000";

$purchaseOrder = new XeroAPI\XeroPHP\Models\Accounting\PurchaseOrder;
$purchaseOrder->setAttentionTo('Peter Parker');

$purchaseOrders = new XeroAPI\XeroPHP\Models\Accounting\PurchaseOrders;
$arr_purchase_orders = [];
array_push($arr_purchase_orders, $purchaseOrder);
$purchaseOrders->setPurchaseOrders($arr_purchase_orders);

try {
  $result = $apiInstance->updatePurchaseOrder($xeroTenantId, $purchaseOrderID, $purchaseOrders);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updatePurchaseOrder: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrderID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Purchase Order
my $purchaseOrders = ::Object::PurchaseOrders->new(); # PurchaseOrders | 

eval { 
    my $result = $api_instance->updatePurchaseOrder(xeroTenantId => $xeroTenantId, purchaseOrderID => $purchaseOrderID, purchaseOrders => $purchaseOrders);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updatePurchaseOrder: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_purchase_order():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    purchase_order_id = '00000000-0000-0000-0000-000000000000'

    purchase_order = PurchaseOrder(
        attentionTo = "Peter Parker")

    purchaseOrders = PurchaseOrders( 
        purchase_orders = [purchase_order])
    
    try:
        api_response = api_instance.update_purchase_order(xero_tenant_id, purchase_order_id, purchaseOrders)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updatePurchaseOrder: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID
    let purchaseOrders = { "PurchaseOrders": [ { "AttentionTo": "Peter Parker", "LineItems": [], "Contact": {} } ] }; // PurchaseOrders

    let mut context = AccountingApi::Context::default();
    let result = client.updatePurchaseOrder(xeroTenantId, purchaseOrderID, purchaseOrders, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
PurchaseOrderID*
UUID (uuid)
Unique identifier for an Purchase Order
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
purchaseOrders *
PurchaseOrders
Required

updatePurchaseOrderAttachmentByFileName

Updates a specific attachment for a specific purchase order by filename


/PurchaseOrders/{PurchaseOrderID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/PurchaseOrders/{PurchaseOrderID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID purchaseOrderID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.updatePurchaseOrderAttachmentByFileName(accessToken, xeroTenantId, purchaseOrderID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updatePurchaseOrderAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Purchase Order
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.updatePurchaseOrderAttachmentByFileName(xeroTenantId, purchaseOrderID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updatePurchaseOrderAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *purchaseOrderID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Purchase Order (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific attachment for a specific purchase order by filename
[apiInstance updatePurchaseOrderAttachmentByFileNameWith:xeroTenantId
    purchaseOrderID:purchaseOrderID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const purchaseOrderID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.updatePurchaseOrderAttachmentByFileName(xeroTenantId, purchaseOrderID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdatePurchaseOrderAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var purchaseOrderID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.UpdatePurchaseOrderAttachmentByFileNameAsync(accessToken, xeroTenantId, purchaseOrderID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdatePurchaseOrderAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$purchaseOrderID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->updatePurchaseOrderAttachmentByFileName($xeroTenantId, $purchaseOrderID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updatePurchaseOrderAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $purchaseOrderID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Purchase Order
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->updatePurchaseOrderAttachmentByFileName(xeroTenantId => $xeroTenantId, purchaseOrderID => $purchaseOrderID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updatePurchaseOrderAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_purchase_order_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    purchase_order_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.update_purchase_order_attachment_by_file_name(xero_tenant_id, purchase_order_id, file_name, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updatePurchaseOrderAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let purchaseOrderID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.updatePurchaseOrderAttachmentByFileName(xeroTenantId, purchaseOrderID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
PurchaseOrderID*
UUID (uuid)
Unique identifier for an Purchase Order
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

updateQuote

Updates a specific quote


/Quotes/{QuoteID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes/{QuoteID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID quoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);
        
        Contact contact = new Contact();
        contact.setContactID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        Quote quote = new Quote();
        quote.setReference("I am an update");
        quote.setContact(contact);
        quote.setDate(dateValue);
        
        Quotes quotes = new Quotes();
        quotes.addQuotesItem(quote);

        try {
            Quotes result = apiInstance.updateQuote(accessToken, xeroTenantId, quoteID, quotes);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateQuote");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID quoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Quote
        Quotes quotes = { "Quotes": [ { "Reference": "I am an update", "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "Date": "2020-02-01" } ] }; // Quotes | 
        try {
            Quotes result = apiInstance.updateQuote(xeroTenantId, quoteID, quotes);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateQuote");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *quoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Quote (default to null)
Quotes *quotes = { "Quotes": [ { "Reference": "I am an update", "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "Date": "2020-02-01" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific quote
[apiInstance updateQuoteWith:xeroTenantId
    quoteID:quoteID
    quotes:quotes
              completionHandler: ^(Quotes output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const quoteID = '00000000-0000-0000-0000-000000000000';
const dateValue = '2020-10-10'

const contact: Contact = { 
    contactID: "00000000-0000-0000-0000-000000000000" }; 

const quote: Quote = { 
    reference: "I am an update",
    contact: contact,
    date: dateValue }; 

const quotes: Quotes = {  
    quotes: [quote] }; 

try {
  const response = await xero.accountingApi.updateQuote(xeroTenantId, quoteID, quotes);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateQuoteExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var quoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var dateValue = DateTime.Now;

            var contact = new Contact();
            contact.ContactID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var quote = new Quote();
            quote.Reference = "I am an update";
            quote.Contact = contact;
            quote.Date = dateValue;

            var quotes = new Quotes();
            var quotesList = new List<Quote>();
            quotesList.Add(quote); 
            quotes._Quotes = quotesList;
            
            try {
                var result = await apiInstance.UpdateQuoteAsync(accessToken, xeroTenantId, quoteID, quotes);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateQuote: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$quoteID = "00000000-0000-0000-0000-000000000000";
$dateValue = new DateTime('2020-12-10');

$contact = new XeroAPI\XeroPHP\Models\Accounting\Contact;
$contact->setContactID('00000000-0000-0000-0000-000000000000');

$quote = new XeroAPI\XeroPHP\Models\Accounting\Quote;
$quote->setReference('I am an update');
$quote->setContact($contact);
$quote->setDate($dateValue);

$quotes = new XeroAPI\XeroPHP\Models\Accounting\Quotes;
$arr_quotes = [];
array_push($arr_quotes, $quote);
$quotes->setQuotes($arr_quotes);

try {
  $result = $apiInstance->updateQuote($xeroTenantId, $quoteID, $quotes);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateQuote: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $quoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Quote
my $quotes = ::Object::Quotes->new(); # Quotes | 

eval { 
    my $result = $api_instance->updateQuote(xeroTenantId => $xeroTenantId, quoteID => $quoteID, quotes => $quotes);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateQuote: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_quote():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    quote_id = '00000000-0000-0000-0000-000000000000'
    date_value = dateutil.parser.parse('2020-12-03T00:00:00Z')

    contact = Contact(
        contact_id = "00000000-0000-0000-0000-000000000000")

    quote = Quote(
        reference = "I am an update",
        contact = contact,
        date = date_value)

    quotes = Quotes( 
        quotes = [quote])
    
    try:
        api_response = api_instance.update_quote(xero_tenant_id, quote_id, quotes)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateQuote: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let quoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let quotes = { "Quotes": [ { "Reference": "I am an update", "Contact": { "ContactID": "00000000-0000-0000-0000-000000000000" }, "Date": "2020-02-01" } ] }; // Quotes

    let mut context = AccountingApi::Context::default();
    let result = client.updateQuote(xeroTenantId, quoteID, quotes, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
QuoteID*
UUID (uuid)
Unique identifier for an Quote
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
quotes *
Quotes
Required

updateQuoteAttachmentByFileName

Updates a specific attachment from a specific quote by filename


/Quotes/{QuoteID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Quotes/{QuoteID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID quoteID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.updateQuoteAttachmentByFileName(accessToken, xeroTenantId, quoteID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateQuoteAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID quoteID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for an Quote
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.updateQuoteAttachmentByFileName(xeroTenantId, quoteID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateQuoteAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *quoteID = 00000000-0000-0000-0000-000000000000; // Unique identifier for an Quote (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific attachment from a specific quote by filename
[apiInstance updateQuoteAttachmentByFileNameWith:xeroTenantId
    quoteID:quoteID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const quoteID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.updateQuoteAttachmentByFileName(xeroTenantId, quoteID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateQuoteAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var quoteID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.UpdateQuoteAttachmentByFileNameAsync(accessToken, xeroTenantId, quoteID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateQuoteAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$quoteID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->updateQuoteAttachmentByFileName($xeroTenantId, $quoteID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateQuoteAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $quoteID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for an Quote
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->updateQuoteAttachmentByFileName(xeroTenantId => $xeroTenantId, quoteID => $quoteID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateQuoteAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_quote_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    quote_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.update_quote_attachment_by_file_name(xero_tenant_id, quote_id, file_name, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateQuoteAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let quoteID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.updateQuoteAttachmentByFileName(xeroTenantId, quoteID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
QuoteID*
UUID (uuid)
Unique identifier for an Quote
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

updateReceipt

Updates a specific draft expense claim receipts


/Receipts/{ReceiptID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Receipts/{ReceiptID}?unitdp=4"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID receiptID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        Integer unitdp = 4;
        LocalDate dateValue = LocalDate.of(2020, Month.OCTOBER, 10);
        
        User user = new User();
        user.setUserID(UUID.fromString("00000000-0000-0000-0000-000000000000"));
        
        Receipt receipt = new Receipt();
        receipt.setUser(user);
        receipt.setReference("Foobar");
        receipt.setDate(dateValue);
        
        Receipts receipts = new Receipts();
        receipts.addReceiptsItem(receipt);

        try {
            Receipts result = apiInstance.updateReceipt(accessToken, xeroTenantId, receiptID, receipts, unitdp);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateReceipt");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID receiptID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Receipt
        Receipts receipts = { "Receipts": [ { "Lineitems": [], "User": { "UserID": "00000000-0000-0000-0000-000000000000" }, "Reference": "Foobar" } ] }; // Receipts | 
        Integer unitdp = 4; // Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
        try {
            Receipts result = apiInstance.updateReceipt(xeroTenantId, receiptID, receipts, unitdp);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateReceipt");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *receiptID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Receipt (default to null)
Receipts *receipts = { "Receipts": [ { "Lineitems": [], "User": { "UserID": "00000000-0000-0000-0000-000000000000" }, "Reference": "Foobar" } ] }; // 
Integer *unitdp = 4; // e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts (optional) (default to null)

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific draft expense claim receipts
[apiInstance updateReceiptWith:xeroTenantId
    receiptID:receiptID
    receipts:receipts
    unitdp:unitdp
              completionHandler: ^(Receipts output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const receiptID = '00000000-0000-0000-0000-000000000000';
const unitdp = 4;
const dateValue = '2020-10-10'

const user: User = { 
    userID: "00000000-0000-0000-0000-000000000000" }; 

const receipt: Receipt = { 
    user: user,
    reference: "Foobar",
    date: dateValue }; 

const receipts: Receipts = {  
    receipts: [receipt] }; 

try {
  const response = await xero.accountingApi.updateReceipt(xeroTenantId, receiptID, receipts,  unitdp);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateReceiptExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var receiptID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var unitdp = 4;
            var dateValue = DateTime.Now;

            var user = new User();
            user.UserID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var receipt = new Receipt();
            receipt.User = user;
            receipt.Reference = "Foobar";
            receipt.Date = dateValue;

            var receipts = new Receipts();
            var receiptsList = new List<Receipt>();
            receiptsList.Add(receipt); 
            receipts._Receipts = receiptsList;
            
            try {
                var result = await apiInstance.UpdateReceiptAsync(accessToken, xeroTenantId, receiptID, receipts, unitdp);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateReceipt: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$receiptID = "00000000-0000-0000-0000-000000000000";
$unitdp = 4;
$dateValue = new DateTime('2020-12-10');

$user = new XeroAPI\XeroPHP\Models\Accounting\User;
$user->setUserID('00000000-0000-0000-0000-000000000000');

$receipt = new XeroAPI\XeroPHP\Models\Accounting\Receipt;
$receipt->setUser($user);
$receipt->setReference('Foobar');
$receipt->setDate($dateValue);

$receipts = new XeroAPI\XeroPHP\Models\Accounting\Receipts;
$arr_receipts = [];
array_push($arr_receipts, $receipt);
$receipts->setReceipts($arr_receipts);

try {
  $result = $apiInstance->updateReceipt($xeroTenantId, $receiptID, $receipts, $unitdp);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateReceipt: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $receiptID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Receipt
my $receipts = ::Object::Receipts->new(); # Receipts | 
my $unitdp = 4; # Integer | e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

eval { 
    my $result = $api_instance->updateReceipt(xeroTenantId => $xeroTenantId, receiptID => $receiptID, receipts => $receipts, unitdp => $unitdp);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateReceipt: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_receipt():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    receipt_id = '00000000-0000-0000-0000-000000000000'
    dateValue = dateutil.parser.parse('2020-10-10T00:00:00Z')

    user = User(
        user_id = "00000000-0000-0000-0000-000000000000")

    receipt = Receipt(
        user = user,
        reference = "Foobar",
        date = dateValue)

    receipts = Receipts( 
        receipts = [receipt])
    
    try:
        api_response = api_instance.update_receipt(xero_tenant_id, receipt_id, receipts, unitdp)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateReceipt: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let receiptID = 00000000-0000-0000-0000-000000000000; // UUID
    let receipts = { "Receipts": [ { "Lineitems": [], "User": { "UserID": "00000000-0000-0000-0000-000000000000" }, "Reference": "Foobar" } ] }; // Receipts
    let unitdp = 4; // Integer

    let mut context = AccountingApi::Context::default();
    let result = client.updateReceipt(xeroTenantId, receiptID, receipts, unitdp, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.transactions Grant read-write access to bank transactions, credit notes, invoices, repeating invoices

Parameters

Path parameters
Name Description
ReceiptID*
UUID (uuid)
Unique identifier for a Receipt
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
receipts *
Receipts
Required
Query parameters
Name Description
unitdp
Integer
e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts

updateReceiptAttachmentByFileName

Updates a specific attachment on a specific expense claim receipts by file name


/Receipts/{ReceiptID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/Receipts/{ReceiptID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID receiptID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.updateReceiptAttachmentByFileName(accessToken, xeroTenantId, receiptID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateReceiptAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID receiptID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Receipt
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.updateReceiptAttachmentByFileName(xeroTenantId, receiptID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateReceiptAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *receiptID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Receipt (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific attachment on a specific expense claim receipts by file name
[apiInstance updateReceiptAttachmentByFileNameWith:xeroTenantId
    receiptID:receiptID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const receiptID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.updateReceiptAttachmentByFileName(xeroTenantId, receiptID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateReceiptAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var receiptID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.UpdateReceiptAttachmentByFileNameAsync(accessToken, xeroTenantId, receiptID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateReceiptAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$receiptID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->updateReceiptAttachmentByFileName($xeroTenantId, $receiptID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateReceiptAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $receiptID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Receipt
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->updateReceiptAttachmentByFileName(xeroTenantId => $xeroTenantId, receiptID => $receiptID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateReceiptAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_receipt_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    receipt_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.update_receipt_attachment_by_file_name(xero_tenant_id, receipt_id, file_name, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateReceiptAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let receiptID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.updateReceiptAttachmentByFileName(xeroTenantId, receiptID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
ReceiptID*
UUID (uuid)
Unique identifier for a Receipt
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

updateRepeatingInvoiceAttachmentByFileName

Updates a specific attachment from a specific repeating invoices by file name


/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/RepeatingInvoices/{RepeatingInvoiceID}/Attachments/{FileName}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID repeatingInvoiceID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        String fileName = 'xero-dev.jpg';
        
        File input = new File("/path/to/local/xero-dev.jpg");
        java.nio.file.Path inputPath = input.toPath();
        byte[] body = FileUtils.readFileToByteArray(input);
        String mimeType = Files.probeContentType(inputPath);

        try {
            Attachments result = apiInstance.updateRepeatingInvoiceAttachmentByFileName(accessToken, xeroTenantId, repeatingInvoiceID, fileName, body, mimeType);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateRepeatingInvoiceAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Repeating Invoice
        String fileName = xero-dev.jpg; // String | Name of the attachment
        byte[] body = BYTE_ARRAY_DATA_HERE; // byte[] | 
        try {
            Attachments result = apiInstance.updateRepeatingInvoiceAttachmentByFileName(xeroTenantId, repeatingInvoiceID, fileName, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateRepeatingInvoiceAttachmentByFileName");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Repeating Invoice (default to null)
String *fileName = xero-dev.jpg; // Name of the attachment (default to null)
byte[] *body = BYTE_ARRAY_DATA_HERE; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific attachment from a specific repeating invoices by file name
[apiInstance updateRepeatingInvoiceAttachmentByFileNameWith:xeroTenantId
    repeatingInvoiceID:repeatingInvoiceID
    fileName:fileName
    body:body
              completionHandler: ^(Attachments output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const repeatingInvoiceID = '00000000-0000-0000-0000-000000000000';
const fileName = 'xero-dev.jpg';
const path = require("path");
const mime = require("mime-types");
const pathToUpload = path.resolve(__dirname, "../public/images/xero-dev.jpg"); // determine the path to your file
const body = fs.createReadStream(pathToUpload); // {fs.ReadStream} read the file
const contentType = mime.lookup(fileName);

try {
  const response = await xero.accountingApi.updateRepeatingInvoiceAttachmentByFileName(xeroTenantId, repeatingInvoiceID, fileName, body, {
    headers: {
      "Content-Type": contentType,
    }
  });
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateRepeatingInvoiceAttachmentByFileNameExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var repeatingInvoiceID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var fileName = "xero-dev.jpg";
            byte[] body = System.IO.File.ReadAllBytes(fileName);
            
            try {
                var result = await apiInstance.UpdateRepeatingInvoiceAttachmentByFileNameAsync(accessToken, xeroTenantId, repeatingInvoiceID, fileName, body);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateRepeatingInvoiceAttachmentByFileName: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$repeatingInvoiceID = "00000000-0000-0000-0000-000000000000";
$fileName = "xero-dev.jpg";

$handle = fopen($fileName, "r");
$body = fread($handle, filesize($fileName));
fclose($handle);

try {
  $result = $apiInstance->updateRepeatingInvoiceAttachmentByFileName($xeroTenantId, $repeatingInvoiceID, $fileName, $body);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateRepeatingInvoiceAttachmentByFileName: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Repeating Invoice
my $fileName = xero-dev.jpg; # String | Name of the attachment
my $body = ::Object::byte[]->new(); # byte[] | 

eval { 
    my $result = $api_instance->updateRepeatingInvoiceAttachmentByFileName(xeroTenantId => $xeroTenantId, repeatingInvoiceID => $repeatingInvoiceID, fileName => $fileName, body => $body);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateRepeatingInvoiceAttachmentByFileName: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_repeating_invoice_attachment_by_file_name():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    repeating_invoice_id = '00000000-0000-0000-0000-000000000000'
    file_name = 'xero-dev.jpg'
    
    path_to_upload = Path(__file__).resolve().parent.joinpath(fileName)
    open_file = open(path_to_upload, 'rb')
        body = open_file.read()
    
    try:
        api_response = api_instance.update_repeating_invoice_attachment_by_file_name(xero_tenant_id, repeating_invoice_id, file_name, body)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateRepeatingInvoiceAttachmentByFileName: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let repeatingInvoiceID = 00000000-0000-0000-0000-000000000000; // UUID
    let fileName = xero-dev.jpg; // String
    let body = BYTE_ARRAY_DATA_HERE; // byte[]

    let mut context = AccountingApi::Context::default();
    let result = client.updateRepeatingInvoiceAttachmentByFileName(xeroTenantId, repeatingInvoiceID, fileName, body, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.attachments Grant read-write access to attachments

Parameters

Path parameters
Name Description
RepeatingInvoiceID*
UUID (uuid)
Unique identifier for a Repeating Invoice
Required
FileName*
String
Name of the attachment
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
body *
byte[]
Byte array of file in body of request
Required

updateTaxRate

Updates tax rates


/TaxRates

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/TaxRates"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        
        TaxComponent taxComponent = new TaxComponent();
        taxComponent.setName("State Tax");
        taxComponent.setRate(2.25);

        List<TaxComponents> taxComponents = new ArrayList<TaxComponents>();
        taxComponents.add(taxComponent);
        
        TaxRate taxRate = new TaxRate();
        taxRate.setName("CA State Tax");
        taxRate.setTaxComponents(taxComponents);
        
        TaxRates taxRates = new TaxRates();
        taxRates.addTaxRatesItem(taxRate);

        try {
            TaxRates result = apiInstance.updateTaxRate(accessToken, xeroTenantId, taxRates);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateTaxRate");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        TaxRates taxRates = { "TaxRates": [ { "Name": "State Tax NY", "TaxComponents": [ { "Name": "State Tax", "Rate": 2.25 } ], "Status": "DELETED", "ReportTaxType": "INPUT" } ] }; // TaxRates | 
        try {
            TaxRates result = apiInstance.updateTaxRate(xeroTenantId, taxRates);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateTaxRate");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
TaxRates *taxRates = { "TaxRates": [ { "Name": "State Tax NY", "TaxComponents": [ { "Name": "State Tax", "Rate": 2.25 } ], "Status": "DELETED", "ReportTaxType": "INPUT" } ] }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates tax rates
[apiInstance updateTaxRateWith:xeroTenantId
    taxRates:taxRates
              completionHandler: ^(TaxRates output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';

const taxComponent: TaxComponent = { 
    name: "State Tax",
    rate: 2.25 };   
const taxComponents = [];    
taxComponents.push(taxComponent)

const taxRate: TaxRate = { 
    name: "CA State Tax",
    taxComponents: taxComponents,

const taxRates: TaxRates = {  
    taxRates: [taxRate] }; 

try {
  const response = await xero.accountingApi.updateTaxRate(xeroTenantId, taxRates);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateTaxRateExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";

            var taxComponent = new TaxComponent();
            taxComponent.Name = "State Tax";
            taxComponent.Rate = new decimal(2.25);
            var taxComponents = new List<TaxComponent>();
            taxComponents.Add(taxComponent);

            var taxRate = new TaxRate();
            taxRate.Name = "CA State Tax";
            taxRate.TaxComponents = taxComponents;

            var taxRates = new TaxRates();
            var taxRatesList = new List<TaxRate>();
            taxRatesList.Add(taxRate); 
            taxRates._TaxRates = taxRatesList;
            
            try {
                var result = await apiInstance.UpdateTaxRateAsync(accessToken, xeroTenantId, taxRates);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateTaxRate: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";

$taxComponent = new XeroAPI\XeroPHP\Models\Accounting\TaxComponent;
$taxComponent->setName('State Tax');
$taxComponent->setRate(2.25);
$taxComponents = [];
array_push($taxComponents, $taxComponent);

$taxRate = new XeroAPI\XeroPHP\Models\Accounting\TaxRate;
$taxRate->setName('CA State Tax');
$taxRate->setTaxComponents($taxComponents);

$taxRates = new XeroAPI\XeroPHP\Models\Accounting\TaxRates;
$arr_tax_rates = [];
array_push($arr_tax_rates, $taxRate);
$taxRates->setTaxRates($arr_tax_rates);

try {
  $result = $apiInstance->updateTaxRate($xeroTenantId, $taxRates);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateTaxRate: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $taxRates = ::Object::TaxRates->new(); # TaxRates | 

eval { 
    my $result = $api_instance->updateTaxRate(xeroTenantId => $xeroTenantId, taxRates => $taxRates);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateTaxRate: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_tax_rate():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'

    tax_component = TaxComponent(
        name = "State Tax",
        rate = 2.25)
    
    taxComponents = []    
    tax_components.append(tax_component)

    tax_rate = TaxRate(
        name = "CA State Tax",
        taxComponents = taxComponents,

    taxRates = TaxRates( 
        tax_rates = [tax_rate])
    
    try:
        api_response = api_instance.update_tax_rate(xero_tenant_id, taxRates)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateTaxRate: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let taxRates = { "TaxRates": [ { "Name": "State Tax NY", "TaxComponents": [ { "Name": "State Tax", "Rate": 2.25 } ], "Status": "DELETED", "ReportTaxType": "INPUT" } ] }; // TaxRates

    let mut context = AccountingApi::Context::default();
    let result = client.updateTaxRate(xeroTenantId, taxRates, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
taxRates *
TaxRates
Required

updateTrackingCategory

Updates a specific tracking category


/TrackingCategories/{TrackingCategoryID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/TrackingCategories/{TrackingCategoryID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID trackingCategoryID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        TrackingCategory trackingCategory = new TrackingCategory();
        trackingCategory.setName("Foobar");

        try {
            TrackingCategories result = apiInstance.updateTrackingCategory(accessToken, xeroTenantId, trackingCategoryID, trackingCategory);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateTrackingCategory");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID trackingCategoryID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a TrackingCategory
        TrackingCategory trackingCategory = { "Name": "Avengers" }; // TrackingCategory | 
        try {
            TrackingCategories result = apiInstance.updateTrackingCategory(xeroTenantId, trackingCategoryID, trackingCategory);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateTrackingCategory");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *trackingCategoryID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a TrackingCategory (default to null)
TrackingCategory *trackingCategory = { "Name": "Avengers" }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific tracking category
[apiInstance updateTrackingCategoryWith:xeroTenantId
    trackingCategoryID:trackingCategoryID
    trackingCategory:trackingCategory
              completionHandler: ^(TrackingCategories output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const trackingCategoryID = '00000000-0000-0000-0000-000000000000';

const trackingCategory: TrackingCategory = { 
    name: "Foobar" }; 

try {
  const response = await xero.accountingApi.updateTrackingCategory(xeroTenantId, trackingCategoryID, trackingCategory);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateTrackingCategoryExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var trackingCategoryID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var trackingCategory = new TrackingCategory();
            trackingCategory.Name = "Foobar";
            
            try {
                var result = await apiInstance.UpdateTrackingCategoryAsync(accessToken, xeroTenantId, trackingCategoryID, trackingCategory);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateTrackingCategory: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$trackingCategoryID = "00000000-0000-0000-0000-000000000000";

$trackingCategory = new XeroAPI\XeroPHP\Models\Accounting\TrackingCategory;
$trackingCategory->setName('Foobar');

try {
  $result = $apiInstance->updateTrackingCategory($xeroTenantId, $trackingCategoryID, $trackingCategory);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateTrackingCategory: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $trackingCategoryID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a TrackingCategory
my $trackingCategory = ::Object::TrackingCategory->new(); # TrackingCategory | 

eval { 
    my $result = $api_instance->updateTrackingCategory(xeroTenantId => $xeroTenantId, trackingCategoryID => $trackingCategoryID, trackingCategory => $trackingCategory);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateTrackingCategory: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_tracking_category():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    tracking_category_id = '00000000-0000-0000-0000-000000000000'

    trackingCategory = TrackingCategory(
        name = "Foobar")
    
    try:
        api_response = api_instance.update_tracking_category(xero_tenant_id, tracking_category_id, trackingCategory)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateTrackingCategory: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let trackingCategoryID = 00000000-0000-0000-0000-000000000000; // UUID
    let trackingCategory = { "Name": "Avengers" }; // TrackingCategory

    let mut context = AccountingApi::Context::default();
    let result = client.updateTrackingCategory(xeroTenantId, trackingCategoryID, trackingCategory, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Path parameters
Name Description
TrackingCategoryID*
UUID (uuid)
Unique identifier for a TrackingCategory
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
trackingCategory *
TrackingCategory
Required

updateTrackingOptions

Updates a specific option for a specific tracking category


/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}

Usage and SDK Samples

curl -X  "https://api.xero.com/api.xro/2.0/TrackingCategories/{TrackingCategoryID}/Options/{TrackingOptionID}"
import org.openapitools.client.api.*;
import org.openapitools.client.api.client.AccountingApi;
import org.openapitools.client.models.accounting.*;

import java.io.File;
import java.util.*;

public class AccountingApiExample {
    private AccountingApi apiInstance;
    
    public static void main(String[] args) {
        String accessToken = "YOUR_ACCESS_TOKEN";
        ApiClient defaultClient = new ApiClient();

        apiInstance = AccountingApi.getInstance(defaultClient);
        String xeroTenantId = 'YOUR_XERO_TENANT_ID';
        UUID trackingCategoryID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        UUID trackingOptionID = UUID.fromString("00000000-0000-0000-0000-000000000000");
        
        TrackingOption trackingOption = new TrackingOption();
        trackingOption.setName("Foobar");

        try {
            TrackingOptions result = apiInstance.updateTrackingOptions(accessToken, xeroTenantId, trackingCategoryID, trackingOptionID, trackingOption);
            System.out.println(result);
        } catch (XeroException e) {
            System.err.println("Exception when calling AccountingApi#updateTrackingOptions");
            e.printStackTrace();
        }
    }
}
import org.openapitools.client.api.AccountingApi;

public class AccountingApiExample {

    public static void main(String[] args) {
        AccountingApi apiInstance = new AccountingApi();
        String xeroTenantId = YOUR_XERO_TENANT_ID; // String | Xero identifier for Tenant
        UUID trackingCategoryID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a TrackingCategory
        UUID trackingOptionID = 00000000-0000-0000-0000-000000000000; // UUID | Unique identifier for a Tracking Option
        TrackingOption trackingOption = { name: "Vision" }; // TrackingOption | 
        try {
            TrackingOptions result = apiInstance.updateTrackingOptions(xeroTenantId, trackingCategoryID, trackingOptionID, trackingOption);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AccountingApi#updateTrackingOptions");
            e.printStackTrace();
        }
    }
}
Configuration *apiConfig = [Configuration sharedConfig];

// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];

String *xeroTenantId = YOUR_XERO_TENANT_ID; // Xero identifier for Tenant (default to null)
UUID *trackingCategoryID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a TrackingCategory (default to null)
UUID *trackingOptionID = 00000000-0000-0000-0000-000000000000; // Unique identifier for a Tracking Option (default to null)
TrackingOption *trackingOption = { name: "Vision" }; // 

AccountingApi *apiInstance = [[AccountingApi alloc] init];

// Updates a specific option for a specific tracking category
[apiInstance updateTrackingOptionsWith:xeroTenantId
    trackingCategoryID:trackingCategoryID
    trackingOptionID:trackingOptionID
    trackingOption:trackingOption
              completionHandler: ^(TrackingOptions output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
await xero.setTokenSet(tokenSet);

const xeroTenantId = 'YOUR_XERO_TENANT_ID';
const trackingCategoryID = '00000000-0000-0000-0000-000000000000';
const trackingOptionID = '00000000-0000-0000-0000-000000000000';

const trackingOption: TrackingOption = { 
    name: "Foobar" }; 

try {
  const response = await xero.accountingApi.updateTrackingOptions(xeroTenantId, trackingCategoryID, trackingOptionID, trackingOption);
  console.log(response.body || response.response.statusCode)
} catch (err) {
  const error = JSON.stringify(err.response.body, null, 2)
  console.log(`Status Code: ${err.response.statusCode} => ${error}`);
}
using System;
using System.Diagnostics;
using Xero.NetStandard.OAuth2.Api;
using Xero.NetStandard.OAuth2.Client;
using Xero.NetStandard.OAuth2.Model;

namespace Example
{
    public class UpdateTrackingOptionsExample
    {
        public async Task Main()
        {            
            var accessToken = "YOUR_ACCESS_TOKEN";          
            var apiInstance = new AccountingApi();
            var xeroTenantId = "YOUR_XERO_TENANT_ID";
            var trackingCategoryID = Guid.Parse("00000000-0000-0000-0000-000000000000");
            var trackingOptionID = Guid.Parse("00000000-0000-0000-0000-000000000000");

            var trackingOption = new TrackingOption();
            trackingOption.Name = "Foobar";
            
            try {
                var result = await apiInstance.UpdateTrackingOptionsAsync(accessToken, xeroTenantId, trackingCategoryID, trackingOptionID, trackingOption);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling apiInstance.UpdateTrackingOptions: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: OAuth2
$config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken( 'YOUR_ACCESS_TOKEN' );       

$apiInstance = new XeroAPI\XeroPHP\Api\AccountingApi(
    new GuzzleHttp\Client(),
    $config
);
$xeroTenantId = "YOUR_XERO_TENANT_ID";
$trackingCategoryID = "00000000-0000-0000-0000-000000000000";
$trackingOptionID = "00000000-0000-0000-0000-000000000000";

$trackingOption = new XeroAPI\XeroPHP\Models\Accounting\TrackingOption;
$trackingOption->setName('Foobar');

try {
  $result = $apiInstance->updateTrackingOptions($xeroTenantId, $trackingCategoryID, $trackingOptionID, $trackingOption);
} catch (Exception $e) {
  echo 'Exception when calling AccountingApi->updateTrackingOptions: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use ::Configuration;
use ::AccountingApi;

# Configure OAuth2 access token for authorization: OAuth2
$::Configuration::access_token = 'YOUR_ACCESS_TOKEN';

my $api_instance = ::AccountingApi->new();
my $xeroTenantId = YOUR_XERO_TENANT_ID; # String | Xero identifier for Tenant
my $trackingCategoryID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a TrackingCategory
my $trackingOptionID = 00000000-0000-0000-0000-000000000000; # UUID | Unique identifier for a Tracking Option
my $trackingOption = ::Object::TrackingOption->new(); # TrackingOption | 

eval { 
    my $result = $api_instance->updateTrackingOptions(xeroTenantId => $xeroTenantId, trackingCategoryID => $trackingCategoryID, trackingOptionID => $trackingOptionID, trackingOption => $trackingOption);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling AccountingApi->updateTrackingOptions: $@\n";
}
# configure api_client for use with xero-python sdk client
api_client = ApiClient(
    Configuration(
        debug=false,
        oauth2_token=OAuth2Token(
            client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET"
        ),
    ),
    pool_threads=1,
)

api_client.set_oauth2_token("YOUR_ACCESS_TOKEN")

def accounting_update_tracking_options():
    api_instance = AccountingApi(api_client)
    xero_tenant_id = 'YOUR_XERO_TENANT_ID'
    tracking_category_id = '00000000-0000-0000-0000-000000000000'
    tracking_option_id = '00000000-0000-0000-0000-000000000000'

    trackingOption = TrackingOption(
        name = "Foobar")
    
    try:
        api_response = api_instance.update_tracking_options(xero_tenant_id, tracking_category_id, tracking_option_id, trackingOption)
        print(api_response)
    except AccountingBadRequestException as e:
        print("Exception when calling AccountingApi->updateTrackingOptions: %s\n" % e)
extern crate AccountingApi;

pub fn main() {
    let xeroTenantId = YOUR_XERO_TENANT_ID; // String
    let trackingCategoryID = 00000000-0000-0000-0000-000000000000; // UUID
    let trackingOptionID = 00000000-0000-0000-0000-000000000000; // UUID
    let trackingOption = { name: "Vision" }; // TrackingOption

    let mut context = AccountingApi::Context::default();
    let result = client.updateTrackingOptions(xeroTenantId, trackingCategoryID, trackingOptionID, trackingOption, &context).wait();
    println!("{:?}", result);

}

Scopes

accounting.settings Grant read-write access to organisation and account settings

Parameters

Path parameters
Name Description
TrackingCategoryID*
UUID (uuid)
Unique identifier for a TrackingCategory
Required
TrackingOptionID*
UUID (uuid)
Unique identifier for a Tracking Option
Required
Header parameters
Name Description
xero-tenant-id*
String
Xero identifier for Tenant
Required
Body parameters
Name Description
trackingOption *
TrackingOption
Required